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::ChartDataPoint;
pub use model::ChartSeries;
pub use model::DotPlotGroup;
pub use model::ColumnDef;
pub use model::ColumnWidth;
pub use model::FontEntry;
pub use model::TextRun;
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§

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.