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 document::Document;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;
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.
- 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.
DCTDecodeis passthrough (decoded at the image layer);JPXDecode,Cryptand 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 defaultHashMapuses 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/ObjStmstream. - 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.
- xref
- Cross-reference loading (ISO 32000 §7.5): classic tables, xref streams,
hybrid files (
/XRefStm),/Prevchains, and a whole-file recovery scan when everything else fails.