Skip to main content

Crate lightweight_pdf_core

Crate lightweight_pdf_core 

Source
Expand description

Document model, elements and builder API for lightweight-pdf. No font bytes, no PDF types (plan/00a-contracts-and-artifacts.md, point 3) — this crate knows nothing but the document tree, styling and FontKey.

Structs§

Border
Color
Column
Common
Properties shared by every container/block element: padding, width, height, overflow, background, border, plus flex (taffy-vocabulary, ADR-004) and keep_with_next (ADR-007 / Grundprinzip 9). Deliberately no margin on elements (ADR/03: only padding + Row/Column gap, margin is a Document-level property).
Document
FontKey
Opaque handle for a font. lightweight-pdf-core never sees font bytes, only this key (see plan/00a-contracts-and-artifacts.md, point 3).
Footer
Header
A header band with a fixed, document-creation-time height (ADR-011): the closure may vary its content per page but never the reserved band size.
Image
A validated, embeddable JPEG or PNG. bytes are the original file bytes, kept as-is — pixel decoding (only ever needed for PNG, to split out the alpha channel as a SMask) happens later, in the facade.
Line
List
ListItem
Margin
PageContext
Passed to Header/Footer closures on every (re-)evaluation. Plain data only, so it can live in lightweight-pdf-core without pulling in layout/font knowledge (ADR-010).
Rect
Row
Spacer
Table
TableColumn
Text
TextStyle
Watermark

Enums§

Align
ColumnWidth
A column’s width: fixed(w) reserves an exact width, flex(weight) shares the leftover space proportionally (taffy flex-grow analogy, ADR-004 / 03-builder-api-design.md) — the same distribution step as Row, not a generic flex implementation.
Element
One element in the document tree. Enum-based (not Box<dyn Layoutable>) — a closed, small set of primitives.
ImageError
ImageFormat
Marker
Overflow
Overflow policy for explicitly, fixed-size elements. See plan/05-overflow-and-robustness.md, Grundprinzip 3. Visible is intentionally not part of V1 (ADR-011).
PageFormat
V1 supports a single fixed page size (Phase 0 spike scope: “fixe A4-Größe”). Dimensions in PDF points (1/72 inch).

Functions§

format_currency_de
Formats a cent amount as German currency: thousands-grouped with ., decimal comma, trailing — e.g. format_currency_de(123456) == "1.234,56 €".