Skip to main content

Module document

Module document 

Source
Expand description

The document model: loading, object resolution with caching, the lazily-flattened page tree with attribute inheritance, and document metadata.

Structs§

Document
A loaded PDF document.
DocumentSeed
A document’s immutable core, detached from its single-threaded caches: the file bytes, the merged cross-reference table, the decryption key material, and the flattened page tree. Send + Sync (asserted in this module’s tests), which the Document deliberately is not — this is the value that crosses a thread boundary, one fresh document materializing from it on each side. See Document::seed, Document::from_seed and map_pages.
Metadata
Document information from the trailer /Info dictionary. Only present, well-formed entries are populated.
Page
A single page with inherited attributes already applied.

Functions§

content_stream_data_with
Fetches and decodes one CONTENT stream — page /Contents, a form XObject, a Type3 CharProc, a pattern cell: anything whose bytes feed a content parser rather than an image decoder.
map_pages
Applies work to every page of doc in parallel and returns the results in page order.
page_content_with
A page’s decoded content, awaiting each fetch: the /Contents stream, or all streams of a /Contents array decoded and joined with b"\n". A missing /Contents yields empty content (lenient).