Skip to main content

Crate pdfboss_core

Crate pdfboss_core 

Source
Expand description

Core PDF machinery: syntax, objects, filters, cross-references, the document model, and lazy element iteration (physical file structure with byte spans plus logical document structure), implemented from the PDF specification (ISO 32000).

Re-exports§

pub use crypt::Decryptor;
pub use document::map_pages;
pub use document::page_content_with;
pub use document::Document;
pub use document::DocumentSeed;
pub use document::Metadata;
pub use document::Page;
pub use elements::Element;
pub use elements::ElementOpts;
pub use elements::Span;
pub use elements::XrefKind;
pub use error::Error;
pub use error::Result;
pub use geom::Matrix;
pub use geom::Point;
pub use geom::Rect;
pub use hash::FastMap;
pub use hash::FastSet;
pub use hash::FxHasher;
pub use object::Dict;
pub use object::Name;
pub use object::ObjRef;
pub use object::Object;
pub use object::Stream;
pub use source::block_on;
pub use source::resolve_sync_with;
pub use source::resolve_with;
pub use source::AsyncObjectSource;
pub use source::BoxFuture;
pub use source::Immediate;
pub use source::ObjectSource;
pub use source::MAX_RESOLVE_DEPTH;

Modules§

content
Content-stream operator parsing (ISO 32000 §8/§9), including inline images. Lenient: unknown operators and arity mismatches are skipped (the operand stack is cleared), never an error.
crypt
Decryption for the Standard security handler (ISO 32000 §7.6) opened with the empty user password.
document
The document model: loading, object resolution with caching, the lazily-flattened page tree with attribute inheritance, and document metadata.
elements
Lazy iteration over a document’s elements: the physical file structure (header, indirect objects, cross-reference sections, trailer, startxref, eof) with byte spans, and the logical document structure (pages, fonts, images, annotations, content operators). ISO 32000 §7.5 (file structure) and §7.7 (document structure).
error
Error and result types shared across all pdfboss crates.
filters
Stream filters (ISO 32000 §7.4): FlateDecode, LZWDecode, ASCIIHexDecode, ASCII85Decode, RunLengthDecode, CCITTFaxDecode, JBIG2Decode, plus PNG/TIFF predictors. DCTDecode is passthrough (decoded at the image layer); JPXDecode, Crypt and the rest are unsupported.
geom
Planar geometry shared by text extraction and rendering: points, axis-aligned rectangles, and 2-D affine transformation matrices using the PDF row-vector convention [x y 1] · M.
hash
A fast, non-cryptographic hasher for the small keys PDF machinery hashes in bulk: dictionary names (/Type, /Font, …), object ids (num, gen), and glyph indices. The standard library’s default HashMap uses SipHash-1-3, which is DoS-resistant but far slower than necessary for this data — the keys are short, the maps are in-process, and the input has already been parsed, so hash-flooding is not a concern here.
lexer
Byte-level tokenizer for PDF syntax (ISO 32000 §7.2/§7.3), zero-copy where possible.
object
The PDF object model: the nine basic object types plus indirect references (ISO 32000 §7.3).
objstm
Object streams (ISO 32000 §7.5.7): compressed objects stored inside a /Type/ObjStm stream.
parser
Object parser built on the Lexer, including indirect objects and streams (ISO 32000 §7.3.8/§7.3.10).
pretty
Human-readable, indented pretty-printing of PDF objects.
source
The object-source abstraction shared by the synchronous and asynchronous APIs.
xref
Cross-reference loading (ISO 32000 §7.5): classic tables, xref streams, hybrid files (/XRefStm), /Prev chains, and a whole-file recovery scan when everything else fails.