typstgenv0.3.0

Inputs and PDF options

Pass values into a document through sys.inputs, and control PDF standards, the creation date, page ranges and tagging.

Everything on this page applies to a single compilation. It is set with CLI flags, with CompileOptions in Rust or with extra fields in the Wasm request, not in typstgen.toml.

Values for the document: sys.inputs

--input KEY=VALUE makes a string available to the document. Repeat it for more values:

typstgen compile invoice.typ --input customer=ACME --input number=2026-017
#let customer = sys.inputs.at("customer", default: "Unknown")
= Invoice #sys.inputs.number for #customer

All values are strings. Convert them in the document if you need numbers, for example int(sys.inputs.count).

PDF standards

--pdf-standard makes Typst check the document against a standard and write the matching metadata. The compilation fails if the document cannot conform.

Names Standard
1.4, 1.5, 1.6, 1.7, 2.0 PDF version
a-1b, a-1a, a-2b, a-2u, a-2a, a-3b, a-3u, a-3a, a-4, a-4f, a-4e PDF/A (archiving)
ua-1 PDF/UA-1 (accessibility)

Several standards are separated by commas, for example --pdf-standard a-2b,1.7. Typst rejects combinations that contradict each other:

error: typst compilation failed:
error: choose at most one PDF/A standard

Caution

PDF/A requires a document date. typstgen does not add one on its own, so pass --creation-timestamp (or set SOURCE_DATE_EPOCH), or write #set document(date: …) in the document. Otherwise Typst stops with missing document date.

Creation date and reproducible PDFs

By default typstgen writes no creation date, so the same input gives a byte-identical PDF. --creation-timestamp takes Unix seconds and does two things:

  • it is written as the PDF creation date, unless the document sets its own with #set document(date: …);
  • datetime.today() returns that date, read in UTC, instead of the system clock.

Without the flag, typstgen reads the SOURCE_DATE_EPOCH environment variable, the usual convention for reproducible builds:

SOURCE_DATE_EPOCH=$(git log -1 --format=%ct) typstgen compile report.typ

Page ranges

--pages exports only some pages. Ranges are 1-based and inclusive, separated by commas: 5, 1-3, -3 (up to page 3) and 8- (from page 8 to the end).

typstgen compile report.typ --pages 1,3-

Typst cannot tag a partial export, so a page range always produces an untagged PDF.

Tagged PDF

Typst writes a tagged PDF by default: the file carries the document structure (headings, paragraphs, reading order) for screen readers and other assistive technology. --no-pdf-tags turns this off, which makes the file slightly smaller. PDF/UA-1 always needs tags; with --pdf-standard ua-1 the PDF is tagged regardless.

Rust and Wasm

In Rust, the same settings are fields of CompileOptions, passed to compile_with_options. The Wasm request accepts them as optional JSON fields. Both are listed in the API reference.

Edit this page on GitHub · Docs for v0.3.0