Create PDF
Makes a PDF from a Typst template, named inputs and files.
@lainstack/document/create-pdf · Data
How to use it
Section titled “How to use it”Use Create PDF to make a document such as an invoice, packing list or letter from data and files earlier steps produced. The PDF lands in PDF, ready for Send email attachments or Write object, and Page count says how long it is.
Good to know:
- Named inputs work as in JavaScript Transform. Each one becomes a variable in the template, and a File becomes a path you can show with
#image(logo)or read with#json(data). - Template is written in Typst, a markup language for documents. Page size, margins, fonts, headers, footers and page numbers all live in the template.
- The agent can write the template for you. It starts from ready templates for an invoice, a packing list and a commercial invoice, then opens the PDF a draft run makes to check it.
- A long table can run over as many pages as it needs, repeating its header row on each one.
- Fonts are Noto Sans, Noto Serif and Noto Sans Mono. The template cannot read other files, load web addresses or import packages.
- File name can include references, for example
invoice-{{invoice.number}}.pdf. Empty uses document.pdf, and .pdf is added when missing. - A PDF can take up to 30 seconds, 512 MB of memory, 500 pages and 50 MiB. A template error stops the step and names the line.
- PDFs are made one at a time alongside Extract text, so a step may wait for its turn.
Settings
Section titled “Settings”| Setting | Key | Type | Details |
|---|---|---|---|
| Named inputs (required) | inputs |
Value | Named inputs become Typst variables. Files become paths for image(). |
| Template (required) | template |
Text | Set the page, fonts and layout here. Noto Sans, Noto Serif and Noto Sans Mono are available. At most 200,000 characters. |
| File name | fileName |
Text | Empty uses document.pdf. .pdf is added when missing. |
Outputs
Section titled “Outputs”| Output | Path | Type |
|---|---|---|
file |
Value | |
| Page count | pageCount |
Number |