Expand description
§Forme
A page-native PDF rendering engine.
Most PDF renderers treat a document as an infinite vertical canvas and then slice it into pages after layout. This produces broken tables, orphaned headers, collapsed flex layouts on page boundaries, and years of GitHub issues begging for fixes.
Forme does the opposite: the page is the fundamental unit of layout. Every layout decision—every flex calculation, every line break, every table row placement—is made with the page boundary as a hard constraint. Content doesn’t get “sliced” after the fact. It flows into pages.
§Architecture
Input (JSON/API)
↓
[model] — Document tree: nodes, styles, content
↓
[style] — Resolve cascade, inheritance, defaults
↓
[layout] — Page-aware layout engine
↓
[pdf] — Serialize to PDF bytesRe-exports§
pub use error::FormeError;pub use layout::LayoutInfo;pub use model::CertificationConfig;pub use model::ColumnDef;pub use model::ColumnWidth;pub use model::FontEntry;pub use model::PatternType;pub use model::RedactionPattern;pub use model::RedactionRegion;pub use model::TextRun;pub use model::ChartDataPoint;pub use model::ChartSeries;pub use model::DotPlotGroup;pub use model::Document;pub use model::Metadata;pub use model::Node;pub use model::NodeKind;pub use model::PageConfig;pub use model::PageSize;pub use style::Style;
Modules§
- barcode
- 1D Barcode Generation
- chart
- Chart Rendering
- error
- Structured error types for the Forme rendering engine.
- font
- Font Management
- image_
loader - Image Loading and Decoding
- layout
- Page-Aware Layout Engine
- model
- Document Model
- PDF Serializer
- qrcode
- QR Code Generation
- style
- Style System
- svg
- SVG Parser
- template
- Template expression evaluator.
- text
- Text Layout
Structs§
- Render
Options - Opt-in per-render checks.
Defaultdisables everything, and every disabled check costs nothing — the flag is tested once per render. Deserializes from the camelCase JSON the JS wrappers send ({"auditContent": true}), unknown fields ignored so older engines tolerate newer wrappers.
Functions§
- certify_
pdf - Certify PDF bytes with an X.509 certificate.
- count_
layout_ passes - Number of full layout passes a document needs (1 for the common case; 2–3 only when a page-number sentinel’s reserved width must be corrected). Exposed as the regression guard for the sentinel re-layout optimization.
- find_
text_ regions - Find text regions matching patterns in a PDF.
- merge_
pdfs - Merge multiple PDFs into a single document.
- redact_
pdf - Redact regions of a PDF by overlaying opaque rectangles.
- redact_
text - Redact text matching patterns from a PDF.
- render
- Render a document to PDF bytes.
- render_
json - Render a document described as JSON to PDF bytes.
- render_
json_ with_ layout - Render a document described as JSON to PDF bytes along with layout metadata.
- render_
json_ with_ layout_ and_ options - Like
render_json_with_layout, with opt-inRenderOptions— the JSON-input mirror ofrender_with_layout_and_options, used by the WASM bindings so@formepdf/corecallers can opt into the content audit the way the HTML path already can. - render_
template - Render a template with data to PDF bytes.
- render_
template_ with_ layout - Render a template with data to PDF bytes along with layout metadata and the render’s warnings.
- render_
with_ layout - Render a document to PDF bytes along with layout metadata.
- render_
with_ layout_ and_ options - Like
render_with_layout_and_passes, with opt-inRenderOptions. - render_
with_ layout_ and_ passes - Like
render_with_layout, but also returns the number of layout passes the render took (1 for the common case; 2-3 when a page-number sentinel’s reserved width needed correction). The plain variant discarded this value, which is howrenderHtmlWithLayoutshipped withoutpasseson every target while its declared type promised one. - render_
with_ options - render_
with_ warnings - Render a document to PDF bytes plus any non-fatal warnings (e.g. pdfUa
requested without an embeddable font registered). Same output as
render; the warnings surface through the WASM bindings and the HTML wrapper. - render_
with_ warnings_ and_ passes - Like
render_with_warnings, but also returns the number of layout passes the render took — surfaced through the HTML wrapper for benchmark evidence.