Overview
graphitepdf-layout is the canonical layout layer for GraphitePDF.
It combines page sizing, style resolution, inheritance, asset sizing, text layout, SVG and math resolution, pagination, origin assignment, and z-index ordering into a safe layout tree used by downstream rendering.
Scope
graphitepdf-layout contains:
- authoring types such as
Document,Page,Node, andLayoutStyle - the ordered layout pipeline in
ORDERED_PIPELINE SafeLayoutDocument,SafeLayoutPage, andSafeLayoutNodeLayoutEnginefor turning document input into positioned layout output
Installation
API Summary
| Category | Items |
|---|---|
| Authoring types | Document, Page, Node, NodeKind, LayoutMetadata |
| Style and spacing | LayoutStyle, EdgeInsets |
| Pipeline | ORDERED_PIPELINE, LayoutPipelineStep, LayoutEngine |
| Safe output | SafeLayoutDocument, SafeLayoutPage, SafeLayoutNode, SafeNodeKind, SafeLayoutStyle, SafeFont |
| Legacy compatibility | LayoutDocument, LayoutPage, LayoutNode, LayoutContent |
Example
use ;
use ;
use ;
use ;
Design Principles
- keep layout policy centralized in one canonical crate
- represent downstream-safe geometry and style explicitly
- make pipeline stages inspectable and testable
- integrate text, image, SVG, and math handling without binding directly to PDF output
Role In GraphitePDF
This crate is the bridge between authoring inputs and rendering. Everything that needs positioned, paginated, and inherited scene data should flow through graphitepdf-layout.
License
MIT