Usage
Install a document and a renderer. The registry adds editable Typst files, data types, a typed example, and the licensed fonts under your library alias.
Render with Node
The Node adapter reads the installed Typst files. Run TypeScript with node --import tsx, or compile the helpers and copy the worker and Typst files next to your output.
Render in the browser
Keep both packages pinned at 0.7.0. Copy typst_ts_web_compiler_bg.wasm from the compiler package into your public assets and pass its URL. Next.js and Vite bundle the default worker; other setups can supply a worker factory.
Data
Amounts are safe integers in minor units with an ISO currency code. Your application supplies every amount, including tax and totals; the library only formats them. Dates are ISO calendar dates and are written out for the chosen locale. dueOn also accepts text such as “On receipt”.
Branding
Set brand.name, and add a logo with brand.logo and brand.logoAlt using local PNG, JPEG, or self-contained SVG bytes passed through assets. brand.accent takes a six-digit hex color. To use your own typeface, pass TTF or OTF bytes to the renderer’s fonts option and set the brand font families.
Export profiles
Both adapters produce standard tagged PDFs. PDF/UA-1 and PDF/A-2b are available in Node through the profile option and are validated with veraPDF.