Expand description
The pdfcer COS model layer: objects, lexer, parser, filters, xref
tables and streams, object streams, recovery, Document, the read-only
DocumentView, the writer (full and incremental save), standard-handler
crypto, content-stream parsing and the page tree.
Depends on nothing else in the workspace; pdfcer-core re-exports every
module at its old path (docs/ARCHITECTURE.md §3). No GUI and no network
dependency, and it builds for wasm32-unknown-unknown.
§Spec basis for the header probe
ISO 32000-1:2008 §7.5.2: the first line of a PDF file is %PDF- followed
by 1.N; ISO 32000-2 adds 2.0. The spec puts the marker at byte 0.
HEADER_SCAN_WINDOW’s 1024-byte tolerance is not spec text: it
matches mainstream readers, which accept the marker after a BOM or stray
whitespace (recorded empirically in C:\personal_rag\pdf\). A successful
probe means only “this looks like a PDF and declares version M.N”.
Modules§
- content
- Content-stream token model (ISO 32000-1 §7.8.2, §8.9.7)
- crypto
- Document encryption — ISO 32000-1 §7.6.
- document
- The Document — pdfcer’s single object model (load side)
- filters
- Stream filters (ISO 32000-1 §7.4) — the decode pipeline
- graph
ObjectGraph— one read view over “the document as it is right now”- lexer
- PDF tokenizer (ISO 32000-1 §7.2 lexical conventions + §7.3 token syntax)
- linearization
- Linearization (Fast Web View) detection — ISO 32000-1 Annex F
- object
- COS object model (ISO 32000-1 §7.3)
- objstm
- Object streams (ISO 32000-1 §7.5.7) — compressed indirect objects
- page_
tree - Page tree walk + attribute inheritance (ISO 32000-1 §7.7.3, §7.9.5)
- parser
- COS object parser (ISO 32000-1 §7.3 object grammar)
- recover
- Cross-reference recovery — rebuild-by-scan (decision 013 Pass B)
- span
- Byte-span provenance — the foundation of round-trip / minimal-diff
- view
view— “the document as it is right now”, for every READ path- writer
- The writer — save paths for
ARCHITECTURE.md§5 - xref
- Cross-reference machinery (ISO 32000-1 §7.5.4–§7.5.8)
Structs§
- PdfVersion
- A PDF version number as declared in the file header (
%PDF-M.N).
Enums§
- PdfError
- Errors that can arise from the Pass 0 header-probe surface.
Constants§
- HEADER_
SCAN_ WINDOW - The maximum number of leading bytes scanned for the
%PDF-header.
Functions§
- probe_
cos_ header - Probe a COS-family file whose header is NOT
%PDF-(Pass 10.2). - probe_
file - Probe a PDF file on disk and return its declared version.
- probe_
header - Probe the leading bytes of a candidate PDF and return its declared version.