Skip to main content

Pure Rust HTML/CSS → PDF engine — wkhtmltopdf replacement

Project description

TypePress

Pure Rust HTML/CSS → PDF engine. No browser required.

License Crates.io

TypePress renders HTML and Markdown to PDF using fulgur (Blitz → Taffy → Krilla) — zero external dependencies, no Chromium, no Node.js.

Features

  • HTML/CSS → PDF — Full HTML rendering with CSS styling
  • Markdown → PDF — GFM extensions, code highlighting via syntect
  • LaTeX Math$...$ and $$...$$ rendered via katex-rs
  • Mermaid Diagrams — Flowchart, sequence, class, state, ER diagrams
  • CJK Support — Chinese/Japanese/Korean with automatic font subsetting
  • Single Binary — ~15MB, zero dependencies, no Chromium/Node.js
  • CSS Grid/Flexbox → Table — Automatic layout degradation for taffy compatibility
  • Header/Footer — CSS GCPM running elements
  • @font-face — Web font loading and embedding
  • Small Output — 93KB PDF vs browser screenshots (MB scale)

Quick Start

Install

# Rust / Cargo
cargo install typepress

# npm (Node.js)
npm install typepress-pdf

# pip (Python)
pip install typepress

Basic Usage

# Markdown → PDF
typepress doc.md -o out.pdf

# HTML → PDF with CJK font
typepress page.html -o out.pdf -f /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc

# With math support
typepress doc.md -o out.pdf --math

# YAML-driven workflow
typepress render  # auto-detects typepress.yaml

Configuration

Create typepress.yaml in your project root:

input: doc.md
from: md
output:
  pdf: out.pdf
page:
  size: A4
math: true

Comparison

TypePress wkhtmltopdf Puppeteer Paper Muncher
No browser
Binary size ~15MB ~40MB ~300MB ~200MB
CSS Grid 🟡 table fallback
Math (KaTeX)
Mermaid
Markdown input
Output size 93KB 200KB 2MB varies

Architecture

Markdown/HTML → CSS Layout Preprocess → Header/Footer → Math → Mermaid → Code Highlight → fulgur → PDF
                                                                               ↑
                                                                    Blitz → Taffy → Krilla
  • Blitz — HTML/CSS parsing
  • Taffy — CSS box layout engine
  • Krilla — PDF generation
  • TypePress — Preprocessing pipeline + CLI

Known Limitations

Taffy (layout engine) does not yet support:

  • CSS Grid (display: grid) — automatically converted to <table>
  • CSS Flexbox (display: flex) — automatically converted to <table>
  • CSS gradients — degraded to solid colors

These are transparent preprocess steps; your HTML renders correctly, just with simplified layout.

Contributing

See CONTRIBUTING.md for development setup and workflow.

TypePress follows OpenSpec spec-driven development. Changes are planned in proposal.mddesign.mdspecs/tasks.md before implementation.

License

Licensed under either of MIT or Apache-2.0, at your option.

Based on fulgur (MIT/Apache-2.0).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

typepress-0.4.0.tar.gz (879.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typepress-0.4.0-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file typepress-0.4.0.tar.gz.

File metadata

  • Download URL: typepress-0.4.0.tar.gz
  • Upload date:
  • Size: 879.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for typepress-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e4ec24a4b7ee0a94b4fe4c468ad094983fbd54c272af9bb643fe185a9a6569d2
MD5 eca40bd6705255af9986b8f6bb572a87
BLAKE2b-256 b513b520c14aeb6ed7a0afec24ef6dd04101ffa525703e1e2dd9bcbadc8682dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for typepress-0.4.0.tar.gz:

Publisher: release.yml on alitrack/typepress

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typepress-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: typepress-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for typepress-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dace4b53776815d14c81af3b9ff98a861a4dfb2f638fd31d2f824ac728348943
MD5 cd5a99b24c42b67f4e594dfcdcebaf0b
BLAKE2b-256 02273f08899c4a033698c1610d11b62710c8f48d24a7473ca6a62cb3527de581

See more details on using hashes here.

Provenance

The following attestation bundles were made for typepress-0.4.0-py2.py3-none-any.whl:

Publisher: release.yml on alitrack/typepress

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page