Struct lopdf::Document[][src]

pub struct Document {
    pub version: String,
    pub trailer: Dictionary,
    pub reference_table: Xref,
    pub objects: BTreeMap<ObjectId, Object>,
    pub max_id: u32,
    pub max_bookmark_id: u32,
    pub bookmarks: Vec<u32>,
    pub bookmark_table: HashMap<u32, Bookmark>,
}
Expand description

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.

max_id: u32

Current maximum object id within the document.

max_bookmark_id: u32

Current maximum object id within Bookmarks.

bookmarks: Vec<u32>

The bookmarks in the document. Render at the very end of document after renumbering objects.

bookmark_table: HashMap<u32, Bookmark>

used to locate a stored Bookmark so children can be appended to it via its id. Otherwise we need to do recrusive lookups and returns on the bookmarks internal layout Vec

Implementations

Create new PDF document.

Adjusts the Parents that have a ObjectId of (0,_) to that of their first child. will recruse through all entries till all parents of children are set. This should be ran before building the final bookmark objects but after renumbering of objects.

Follow references if the supplied object is a reference.

Returns a tuple of an optional object id and final object. The object id will be None if the object was not a reference. Otherwise, it will be the last object id in the reference chain.

Get object by object id, will iteratively dereference a referenced object.

Get mutable reference to object by object id, will iteratively dereference a referenced object.

Get page object_id of the specified object object_id

Get dictionary object by id.

Traverse objects from trailer recursively, return all referenced object IDs.

Get catalog dictionary.

Get page numbers and corresponding object ids.

Get content stream object ids of a page.

Get content of a page.

Get resources used by a page.

Get fonts used by a page.

Create new PDF document with version.

Create an object ID.

Add PDF object into document’s object list.

Remove PDF object from document’s object list.

Get decoded page content;

Change producer of document information dictionary.

Compress PDF stream objects.

Decompress PDF stream objects.

Delete pages.

Prune all unused objects.

Delete object by object ID.

Delete zero length stream objects.

Renumber objects, normally called after delete_unused_objects.

Renumber objects with a custom starting id, this is very useful in case of multiple document objects insertion in a single main document

Load a PDF document from a specified file path.

Load a PDF document from an arbitrary source.

Load a PDF document from a memory slice.

Save PDF document to specified file path.

Save PDF to arbitrary target

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.