Pure Rust
HTML parse, CSS resolve, shaping, and PDF emit in one Rust-native pipeline.
LynPDF RS Project Portal
The central portal for LynPDF RS with practical capabilities, API/CLI entry points, architecture references, runnable examples, and production deployment guidance without relying on a headless browser.
try lynpdf-rs
cargo run -- examples/demo-single-page.html -c examples/styles.css -o examples/output/demo-single-page.pdf --font-dir ./fonts
clone example app
git clone https://github.com/mrchoke/lynpdf-rs-example
cd lynpdf-rs-example
cargo run
HTML parse, CSS resolve, shaping, and PDF emit in one Rust-native pipeline.
rustybuzz shaping with Thai cluster fallback, kerning/ligature toggles, variable axes.
External runtime fonts with bootstrap scripts, including TLWG OTF bundle.
Full corpus render run documented at 37/37 pass in current roadmap snapshot.
Core Capabilities
Built on html5ever and lightningcss for robust parsing and validation before layout/rendering.
NFC normalization and rustybuzz shaping with cluster-safe fallback and Thai-aware break behavior.
Kerning, ligatures, and variable font axis controls exposed via API and CLI flags.
User font mapping, font directories, CSS font-face registration, and environment-based fallback priority.
Markdown to HTML preprocessing, default markdown CSS, and syntax-highlight integration.
Raster image support, inline SVG paths/gradients/opacity/transforms, and metadata/link emission.
Quick Start
01
./scripts/download-fonts.sh --dest ./fonts
./scripts/download-fonts.ps1 -Dest ./fonts
The scripts download Google/emoji fonts and automatically extract the TLWG OTF bundle into fonts/tlwg/otf.
02
cargo run -- tests/fixtures/test-01-thai-typography.html \
-c tests/fixtures/test-styles.css \
-o tests/output/test-01-thai-typography-rs.pdf \
--font-dir ./fonts --verbose
Start with the Thai fixture to verify font fallback and shaping behavior from the first run.
03
cargo run --bin render-all-cases -- --all --verbose
cargo test
Generate batch outputs from fixtures and examples, then run regression checks with the test suite.
Developer Interface
use lynpdf_rs::{render_file_to_pdf, RenderOptions};
let options = RenderOptions::default()
.with_user_font_dir("./fonts")
.with_kerning(true)
.with_ligatures(true)
.with_font_variation("wght=500");
let doc = render_file_to_pdf(
"examples/demo-invoice.html",
Some("examples/styles.css"),
"examples/output/demo-invoice.pdf",
options,
)?;
println!("pages={} bytes={}", doc.pages, doc.bytes.len());
Environment override: LYNPDF_FONT_DIRS="/opt/lynpdf/fonts:/usr/local/share/fonts/lynpdf"
Example Gallery
Baseline end-to-end render flow for onboarding and smoke checks.
Pagination behavior, section continuity, and page layout boundaries.
Business document with table blocks, totals, and typography hierarchy.
Poster-style full-page layout with mixed decorative and text elements.
Thai family showcase including shaping-sensitive glyph combinations.
Raster media plus inline SVG with gradients, transforms, and opacity.
Documentation Hub
Current scope, quick commands, API overview, and feature highlights.
Detailed usage for API surfaces, options, and typical integration patterns.
OS, Docker, and service runtime setup with external font policy and scripts.
Pipeline decisions, backend rationale, and next backend/layout considerations.
Fixture coverage matrix, phase status, and acceptance criteria by capability.
Phase D parity notes and validation snapshot for advanced SVG rendering effects.
Clone a ready-to-run Thai checkout web app that generates PDF receipts with lynpdf-rs.
Project Status
Completed Foundation
User font mapping, fallback strategy, and deterministic discovery order are in place.
Completed Text Core
Kerning/ligature toggles, variable axes, and Thai segmentation integration shipped.
Completed Table Pass
Improved table sizing, rowspan handling, and collapse border conflict resolution.
Completed Media Pass
Inline SVG effects, metadata extraction, and clickable link annotations are integrated.