Skip to main content

Crate lightweight_pdf_writer

Crate lightweight_pdf_writer 

Source
Expand description

Minimal, zero-dependency PDF object/xref/stream writer for lightweight-pdf. Never sees Element/RenderNode — only flat write operations (plan/00a-contracts-and-artifacts.md, point 3).

Structs§

CidFont
A subset, embedded TrueType font written as /Subtype /Type0 with a /CIDFontType2 descendant (ADR-012: Identity-H, CIDToGIDMap, ToUnicode). CID space equals the subset’s own glyph-index space (the facade assigns CIDs that way), so CIDToGIDMap is always /Identity and no separate CID-to-GID stream is needed.
ContentBuilder
ImageXObject
One embeddable /Subtype /Image XObject (ISO 32000-1 8.9.5), named for that specific PDF construct the same way CidFont is named for its (Type0/CIDFontType2) construct, rather than for the generic Pdf-noun pattern used by PdfPage/PdfDocument/PdfWriter (those name the crate’s document-structure types; this and CidFont name embeddable resource types). smask, if present, is itself an ImageXObject (always DeviceGray, filter: None, no further smask) — PNG alpha, per ADR-013.
PdfDocument
PdfLinkAnnotation
PdfMetadata
PdfOutlineNode
One entry in the /Outlines bookmark tree (Text::outline_level, resolved). page_index/y mean the same thing as PdfLinkAction::GoTo — resolved against page_refs at write time, not by the caller.
PdfPage
PdfWriter
Ref
A PDF indirect object reference (generation is always 0 in V1 — we never rewrite an existing file).
Rgb
TextRotation
The position/orientation operands for ContentBuilder::text_rotated, grouped into one argument so the method stays under clippy’s too-many-arguments threshold without merging it into ContentBuilder::text.

Enums§

ColorSpace
ImageDataFilter
PdfLinkAction

Functions§

fmt_num
Formats an f32 with a fixed, compact precision suitable for PDF content streams (avoids Rust’s default float Display, which can emit scientific notation or excessive digits).