Skip to main content

Module document

Module document 

Source
Expand description

Top-level reader — bytes → resolved [Document] / Scene.

Glues crate::reader::xref (locate + parse cross-reference table) and crate::reader::parse (decode an indirect object at a given byte offset) into a one-shot pipeline:

  1. [load_xref] — locate startxref, parse the xref table, keep the trailer dict.
  2. [fetch_object] — given an ObjectId, seek to the byte offset, decode the indirect object’s body (recursively resolving references on demand).
  3. read_pdf_to_scene — top-level entry point: bytes → oxideav_scene::Scene in pages mode. Walks the catalog → pages tree → per-page Contents → content-stream parser, and extracts /Info → Metadata.

Round 3 supports PDF 1.4 with a simple xref + uncompressed object streams. FlateDecode-compressed Contents streams are decoded here — the writer FlateDecode-compresses image XObjects + may later compress content streams; supporting it now keeps the reader symmetric with the writer’s output. Object streams (PDF 1.5+) and encryption are deferred to round 4+.

Structs§

DocumentReader
A read-time view of the PDF document — owns the byte slice plus a resolved cross-reference table and a small object cache. Indirect objects are decoded lazily via Self::resolve.

Functions§

decode_stream
Apply the stream’s /Filter (if any) to recover the raw payload.
pdf_date_to_iso8601
Convert a PDF date D:YYYYMMDDHHmmSSOHH'mm' back to ISO-8601. Inputs that don’t start with D: are returned as-is so the scene’s metadata round-trip is lossless for non-date strings.
read_pdf_to_scene
Convenience — open + read straight into a Scene in pages mode. Inverse of crate::write_pdf_from_scene for PDFs the writer would produce.
read_pdf_to_scene_with_certificate
Like read_pdf_to_scene but unlocks a public-key-encrypted PDF (adbe.pkcs7.s3 / s4 / s5) using the supplied X.509 certificate + RSA private key. Round-10 implementation; see crate::pubsec for SubFilter and crypt-method coverage.
read_pdf_to_scene_with_certificate_and_trust_store
Round-17: variant of read_pdf_to_scene_with_certificate that consults a TrustStore when a KARI envelope identifies the originator by IssuerAndSerial or SubjectKeyIdentifier (RFC 5652 §6.2.2) instead of carrying its public point in-band.
read_pdf_to_scene_with_password
Like read_pdf_to_scene but accepts a user / owner password for encrypted PDFs.