Expand description
Public facade for lightweight-pdf: re-exports the lightweight-pdf-core builder API
and adds Document::render() (ADR-002 — this is the crate users add to
Cargo.toml, the place render() becomes public).
Structs§
- Border
- Color
- Column
- Common
- Properties shared by every container/block element:
padding, width, height, overflow, background, border, plusflex(taffy-vocabulary, ADR-004) andkeep_with_next(ADR-007 / Grundprinzip 9). Deliberately nomarginon elements (ADR/03: onlypadding+Row/Columngap, margin is aDocument-level property). - Document
- FontKey
- Opaque handle for a font.
lightweight-pdf-corenever sees font bytes, only this key (seeplan/00a-contracts-and-artifacts.md, point 3). - Font
Registry - 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.
bytesare the original file bytes, kept as-is — pixel decoding (only ever needed for PNG, to split out the alpha channel as aSMask) happens later, in the facade. - Layout
Warning - Line
- List
- List
Item - Margin
- Page
Context - Passed to
Header/Footerclosures on every (re-)evaluation. Plain data only, so it can live inlightweight-pdf-corewithout pulling in layout/font knowledge (ADR-010). - Rect
- Row
- Spacer
- Table
- Table
Column - Text
- Text
Style - Watermark
Enums§
- Align
- Column
Width - A column’s width:
fixed(w)reserves an exact width,flex(weight)shares the leftover space proportionally (taffyflex-growanalogy, ADR-004 /03-builder-api-design.md) — the same distribution step asRow, not a generic flex implementation. - Element
- One element in the document tree. Enum-based (not
Box<dyn Layoutable>) — a closed, small set of primitives. - Font
Error - Image
Embed Error - Image
Error - Image
Format - Layout
Warning Kind - Marker
- Overflow
- Overflow policy for explicitly, fixed-size elements. See
plan/05-overflow-and-robustness.md, Grundprinzip 3.Visibleis intentionally not part of V1 (ADR-011). - Page
Format - V1 supports a single fixed page size (Phase 0 spike scope: “fixe A4-Größe”). Dimensions in PDF points (1/72 inch).
- Render
Error
Traits§
- Document
Ext - Extension trait adding
render()/render_with_diagnostics()(bundled default fonts) andrender_with_fonts()/render_with_fonts_and_diagnostics()(caller-supplied fonts, seefonts.rs::FontRegistry::with_fonts()) tolightweight_pdf_core::Document. Lives here (not inlightweight-pdf-core) because rendering needs layout, fonts and the PDF writer —lightweight-pdf-coremust not depend on any of them (ADR-002). This is the point at whichrender()becomes public (ADR-002).
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 €".