fn end_page(&mut self) {
        let size = match self.page_size.take() {
            Some(size) => size,
            None => return // no page started
        };
        let page_stream = if let Some(level) = self.compression {
            let compressed = deflate::deflate_bytes_zlib_conf(&self.page_buffer, level);
            let mut page = format!(
                "<< /Length {} /Filter [/FlateDecode] >>\nstream\n",
                compressed.len()
            )
            .into_bytes();
            page.extend_from_slice(&compressed);
            page.extend(b"endstream\n");
            page
        } else {
            let mut page = Vec::new();
            page.extend(format!("<< /Length {} >>\nstream\n", self.page_buffer.len()).bytes());
            page.extend(&self.page_buffer);
            page.extend(b"endstream\n");
            page
        };

        // Create the stream object for this page
        let stream_object_id = self.add_object(page_stream, false, false);

        // Create the page object, which describes settings for the whole page
        let mut page_object = b"<< /Type /Page\n \
            /Parent 2 0 R\n \
            /Resources <<\n"
            .to_vec();

        for (idx, _obj) in self.objects.iter().enumerate().filter(|&(_, o)| o.is_xobject) {
            write!(page_object, "/XObject {} 0 R ", idx+1).unwrap();
        }

        write!(page_object,
            " >>\n \
                /MediaBox [0 0 {} {}]\n \
                /Contents {} 0 R\n\
                >>\n",
            size.x(), size.y(), stream_object_id
        ).unwrap();
        self.add_object(page_object, true, false);
    }
/// Dump a page out to disk
Dump a page out to disk
Dump a page out to disk
fn end_page(&mut self) {
        let size = match self.page_size.take() {
            Some(size) => size,
            None => return // no page started
        };
        let page_stream = if let Some(level) = self.compression {
            let compressed = deflate::deflate_bytes_zlib_conf(&self.page_buffer, level);
            let mut page = format!(
                "<< /Length {} /Filter [/FlateDecode] >>\nstream\n",
                compressed.len()
            )
            .into_bytes();
            page.extend_from_slice(&compressed);
            page.extend(b"endstream\n");
            page
        } else {
            let mut page = Vec::new();
            page.extend(format!("<< /Length {} >>\nstream\n", self.page_buffer.len()).bytes());
            page.extend(&self.page_buffer);
            page.extend(b"endstream\n");
            page
        };
        // Create the stream object for this page
        let stream_object_id = self.add_object(page_stream, false, false);
        // Create the page object, which describes settings for the whole page
        let mut page_object = b"<< /Type /Page\n \
            /Parent 2 0 R\n \
            /Resources <<\n"
            .to_vec();
        for (idx, _obj) in self.objects.iter().enumerate().filter(|&(_, o)| o.is_xobject) {
            write!(page_object, "/XObject {} 0 R ", idx+1).unwrap();
        }
        write!(page_object,
            " >>\n \
                /MediaBox [0 0 {} {}]\n \
                /Contents {} 0 R\n\
                >>\n",
            size.x(), size.y(), stream_object_id
        ).unwrap();
        self.add_object(page_object, true, false);
    }
fn end_page ( & mut self ) { let size = match self . page_size . take ( ) { Some ( size ) => size , None => return // no page started } ; let page_stream = if let Some ( level ) = self . compression { let compressed = deflate :: deflate_bytes_zlib_conf ( & self . page_buffer , level ) ; let mut page = format ! ( " \n \n " compressed len ( ) ) . into_bytes ( ) ; page . extend_from_slice ( & compressed ) ; page . extend ( b" \n " ) ; page } else { let mut page = Vec :: new ( ) ; page . extend ( format ! ( " \n \n " self page_buffer len ( ) ) . bytes ( ) ) ; page . extend ( & self . page_buffer ) ; page . extend ( b" \n " ) ; page } ; // Create the stream object for this page let stream_object_id = self . add_object ( page_stream , false , false ) ; // Create the page object, which describes settings for the whole page let mut page_object = b" \n \
 \n \
 \n " . to_vec ( ) ; for ( idx , _obj ) in self . objects . iter ( ) . enumerate ( ) . filter ( | & ( _ , o ) | o . is_xobject ) { write ! ( page_object " " idx 1 ) . unwrap ( ) ; } write ! ( page_object " \n \
 \n \
 \n \
 \n " size x ( ) size y ( ) stream_object_id ) . unwrap ( ) ; self . add_object ( page_object , true , false ) ; }
Dump a page out to disk
Dump a page out to disk
&mut self