LynPDF RS | Project Portal
Description: LynPDF RS Project Portal: Pure Rust HTML/CSS and Markdown to PDF renderer with Thai shaping, runtime font strategy, examples, API usage, and deployment guide.

LynPDF RS Project Portal

# HTML/CSS + Markdown to PDF with a Pure Rust Pipeline

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.

Start In 3 Steps View Repository API Guide Clone Example App

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

### Pure Rust

HTML parse, CSS resolve, shaping, and PDF emit in one Rust-native pipeline.

### Thai + Pali Ready

rustybuzz shaping with Thai cluster fallback, kerning/ligature toggles, variable axes.

### Font Policy

External runtime fonts with bootstrap scripts, including TLWG OTF bundle.

### Regression Coverage

Full corpus render run documented at 37/37 pass in current roadmap snapshot.

Core Capabilities

## What LynPDF RS Delivers

### HTML5 + CSS Parsing

Built on html5ever and lightningcss for robust parsing and validation before layout/rendering.

### Thai Text Shaping

NFC normalization and rustybuzz shaping with cluster-safe fallback and Thai-aware break behavior.

### OpenType Controls

Kerning, ligatures, and variable font axis controls exposed via API and CLI flags.

### Runtime Font Strategy

User font mapping, font directories, CSS font-face registration, and environment-based fallback priority.

### Markdown Pipeline

Markdown to HTML preprocessing, default markdown CSS, and syntax-highlight integration.

### Media + SVG Support

Raster image support, inline SVG paths/gradients/opacity/transforms, and metadata/link emission.

Quick Start

## Run In 3 Practical Steps

01

### Bootstrap Fonts

    ./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

### Render A Fixture

    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

### Run Full Validation

    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

## Rust API And CLI

### Rust API

    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());

### CLI Surface

- lynpdf-rs input.html -o output.pdfbasic render
- --font-dir DIRadd runtime font directory
- --font-map FAMILY=PATHpin family to custom file
- --no-kerning / --no-ligaturesshape feature toggles
- --font-variation AXIS=VALUEvariable axis control
- --syntax-theme NAMEsyntax highlighting theme
- --page-scale PERCENT --fit-to-pagesingle-page fit workflows

Environment override: LYNPDF_FONT_DIRS="/opt/lynpdf/fonts:/usr/local/share/fonts/lynpdf"

Example Gallery

## Reference Documents You Can Run Today

### Single Page

Baseline end-to-end render flow for onboarding and smoke checks.

### Multi-Page

Pagination behavior, section continuity, and page layout boundaries.

### Invoice

Business document with table blocks, totals, and typography hierarchy.

### Certificate

Poster-style full-page layout with mixed decorative and text elements.

### Thai Fonts

Thai family showcase including shaping-sensitive glyph combinations.

### Images + SVG

Raster media plus inline SVG with gradients, transforms, and opacity.

Documentation Hub

## Everything Needed For Integration And Ops

### README

Current scope, quick commands, API overview, and feature highlights.

### API Guide v0.1.0

Detailed usage for API surfaces, options, and typical integration patterns.

### Font Setup

OS, Docker, and service runtime setup with external font policy and scripts.

### Architecture Notes

Pipeline decisions, backend rationale, and next backend/layout considerations.

### Roadmap

Fixture coverage matrix, phase status, and acceptance criteria by capability.

### SVG Validation

Phase D parity notes and validation snapshot for advanced SVG rendering effects.

### Companion Example App

Clone a ready-to-run Thai checkout web app that generates PDF receipts with lynpdf-rs.

Project Status

## Current Delivery Snapshot

Completed Foundation

### Phase A: Font Reliability

User font mapping, fallback strategy, and deterministic discovery order are in place.

Completed Text Core

### Phase B: Thai Shaping Controls

Kerning/ligature toggles, variable axes, and Thai segmentation integration shipped.

Completed Table Pass

### Phase C: Layout + Border Parity

Improved table sizing, rowspan handling, and collapse border conflict resolution.

Completed Media Pass

### Phase D: SVG + Metadata + Links

Inline SVG effects, metadata extraction, and clickable link annotations are integrated.