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 cmap::cid_to_unicode;
pub use cmap::type0_encoding;
pub use cmap::CidCmap;
pub use cmap::CidToUnicode;
pub use cmap::Type0Encoding;
pub use crypt::Decryptor;
pub use document::content_stream_data_with;
pub use document::decoded_stream_data_with;
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 oc::OcState;
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§

cmap
CID CMap parsing and code splitting for composite (Type0) fonts (ISO 32000-1 §9.7.5-9.7.6): begincodespacerange drives variable-width code splitting, begincidrange/begincidchar map codes to CIDs, usecmap layers a CMap over another, and /WMode selects the writing mode. The value domain is codes to CID integers — distinct from the ToUnicode CMaps parsed in pdfboss-text, whose destinations are text.
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 user or the owner password (the empty user password opens transparently).
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 and JPXDecode are passthrough (decoded at the image layer); 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.
oc
Optional-content visibility (ISO 32000-1 §8.11): which optional content groups the document’s default configuration turns off, and whether content gated by an /OC entry or a BDC /OC span is visible.
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.