Skip to main content

Crate forme

Crate forme 

Source
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 bytes

Re-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
PDF Serializer
qrcode
QR Code Generation
style
Style System
svg
SVG Parser
template
Template expression evaluator.
text
Text Layout

Functions§

certify_pdf
Certify PDF bytes with an X.509 certificate.
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_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.
render_with_layout
Render a document to PDF bytes along with layout metadata.