Overview
What typstgen does, where it stops, and how this documentation is organised.
typstgen compiles an existing .typ file to PDF. The Typst engine runs inside typstgen as a Rust
library, so no typst binary has to be installed and no subprocess is started. Where imported
templates live is set in a config file, typstgen.toml, instead of being hardcoded.
One crate, four entry points:
- CLI:
typstgen compile input.typ(defaultclifeature). - MCP server:
typstgen mcplets AI agents check, preview and compile documents (AI agents). - Rust library:
typstgen::compile(path, &config)returns the PDF bytes. - Wasm: the
wasmfeature exportscompile, which takes the source and its imports as a JSON virtual filesystem.
Around the compiler, typstgen covers what business documents need:
- E-invoices: embed ZUGFeRD / Factur-X data in a PDF/A-3b, or write XRechnung 3.0 and Peppol BIS Billing 3.0 as UBL XML, from the same invoice JSON (E-invoices).
- Invoice values:
prepare-invoicecalculates line amounts, tax groups and totals from your own tax configuration (Document profiles). - Archives: a manifest records each build, and
typstgen verifylater proves the PDFs are unchanged and rebuild byte for byte (Archiving).
Where it stops
| typstgen does | typstgen does not |
|---|---|
Compile one .typ file to one PDF |
Watch files or compile folders in bulk |
Resolve imports against configured template directories and Typst packages (@preview/…, @local/…) |
Publish or update packages |
| Bundle Typst’s fallback fonts, optionally add system and custom fonts | Manage clients, numbering or data (its discontinued predecessor docgen did; typstgen replaces only its PDF generation) |
| Report Typst errors and warnings with file, line and column | Export SVG or HTML (PNG only as MCP page preview / render_png) |
Pass sys.inputs, enforce PDF/A or PDF/UA, export page ranges |
Set the PDF identifier or /Creator |
How the docs are organised
- Getting started: install the CLI or the crate and compile a first document.
- Guides, for compiling: templates and imports, fonts, inputs and PDF options, packages and bibliographies and AI agents over MCP.
- Guides, for invoices and records: e-invoices, document profiles and invoice configuration, archiving, signing and checks in CI.
- Reference: CLI commands,
typstgen.tomland the Rust and Wasm API. Item-level documentation lives on docs.rs.
Every PDF in the showcase was compiled by typstgen from the .typ file shown next to
it.