Struct lopdf_bugfix_19072017::Document
[−]
[src]
pub struct Document { pub version: String, pub trailer: Dictionary, pub reference_table: Xref, pub objects: BTreeMap<ObjectId, Object>, pub streams: BTreeMap<u32, ObjectStream>, pub max_id: u32, }
PDF document.
Fields
version: String
The version of the PDF specification to which the file conforms.
trailer: Dictionary
The trailer gives the location of the cross-reference table and of certain special objects.
reference_table: Xref
The cross-reference table contains locations of the indirect objects.
objects: BTreeMap<ObjectId, Object>
The objects that make up the document contained in the file.
streams: BTreeMap<u32, ObjectStream>
The object streams which contains compressed objects.
max_id: u32
Current maximum object id within the document.
Methods
impl Document
[src]
fn new() -> Document
Create new PDF document.
fn with_version<S: Into<String>>(version: S) -> Document
Create new PDF document.
fn get_object(&self, id: ObjectId) -> Option<&Object>
Get object by object id, will recursively dereference a referenced object.
fn traverse_objects<A: Fn(&mut Object) -> ()>(
&mut self,
action: A
) -> Vec<ObjectId>
&mut self,
action: A
) -> Vec<ObjectId>
Traverse objects from trailer recursively, return all referenced object IDs.
fn catalog(&self) -> Option<&Dictionary>
Get catalog dictionary.
fn get_pages(&self) -> BTreeMap<u32, ObjectId>
Get page numbers and corresponding object ids.
impl Document
[src]
fn load<P: AsRef<Path>>(path: P) -> Result<Document>
Load PDF document from specified file path.
fn load_from<R: Read>(source: R) -> Result<Document>
Load PDF document from arbitrary source
impl Document
[src]
fn save<P: AsRef<Path>>(&mut self, path: P) -> Result<File>
Save PDF document to specified file path.
fn save_to<W: Write + Seek>(&mut self, target: &mut W) -> Result<()>
Save PDF to arbitrary target
impl Document
[src]
fn new_object_id(&mut self) -> ObjectId
Create an object ID.
fn add_object<T: Into<Object>>(&mut self, object: T) -> ObjectId
Add PDF object into document's object list.
impl Document
[src]
fn change_producer(&mut self, producer: &str)
Change producer of document information dictionary.
fn compress(&mut self)
Compress PDF stream objects.
fn decompress(&mut self)
Decompress PDF stream objects.
fn delete_pages(&mut self, page_numbers: &[u32])
Delete pages.
fn prune_objects(&mut self) -> Vec<ObjectId>
Prune all unused objects.
fn delete_object(&mut self, id: &ObjectId) -> Option<Object>
Delete object by object ID.
fn delete_zero_length_streams(&mut self) -> Vec<ObjectId>
Delete zero length stream objects.
fn renumber_objects(&mut self)
Renumber objects, normally called after delete_unused_objects.