Skip to content

oxidoc-lab/oxipdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

112 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oxipdf

A standalone, general-purpose native Rust PDF layout and generation engine.

oxipdf consumes a structured layout tree (StyledTree IR) and emits paginated PDF output without browser or LaTeX runtime dependencies.

The core pipeline: IR ingestion, text shaping, spatial layout, fragmentation/pagination, reference resolution, and PDF emission.

Features

  • Pure Rust — no browser, LaTeX, or external runtime required
  • Deterministic output — same input + same fonts = byte-identical PDF
  • HarfBuzz-class text shaping via rustybuzz with OpenType feature support
  • Block, flex, and grid layout via taffy
  • Pagination with widow/orphan control, keep constraints, and cross-references
  • Font subsetting — only used glyphs are embedded
  • SVG support via usvg + svg2pdf
  • Themeable — built-in and custom TOML themes for semantic role styling
  • HTML adapter — optional oxipdf-html crate for HTML+CSS input

Quick Start

use oxipdf::ir::*;

let mut builder = StyledTreeBuilder::new(IrVersion::new(1, 0));
let root = builder.add_node(
    ContentVariant::Container,
    ResolvedStyle::default(),
    None,
    None,
);
let _text = builder.add_child(
    root,
    ContentVariant::Text(TextContent::new("Hello, oxipdf!")),
    ResolvedStyle::default(),
    None,
    None,
);
let tree = builder.build().expect("valid tree");

Architecture

StyledTree IR ─► Text Shaping ─► Spatial Layout ─► Fragmentation ─► PDF Emission
  (oxipdf-ir)   (oxipdf-shaping) (oxipdf-layout)  (oxipdf-fragment) (oxipdf-emit)

Each pipeline stage is a separate crate with a clear contract. Data flows one direction — cross-crate dependency cycles are forbidden.

Crate Purpose
oxipdf-ir IR types, StyledTree, styles, units
oxipdf-shaping Text shaping, font provider, line breaking
oxipdf-layout Spatial layout via taffy
oxipdf-fragment Pagination, fragmentation, cross-references
oxipdf-emit PDF object emission, font subsetting
oxipdf-theme Semantic role to resolved style mapping
oxipdf-html HTML+CSS to StyledTree adapter

Feature Flags

[dependencies]
oxipdf = "0.1"
Flag Default Description
std Yes Full engine (required)
parallel Yes Rayon-based parallelism (disable for WASM)
hyphenation No Knuth-Liang dictionary hyphenation

Minimum Supported Rust Version

Rust 1.85 or later.

License

Licensed under either of

at your option.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages