Document Generator
This node generates a document (PDF or HTML) by combining a template designed in the Templates section with the workflow payload. Rendering uses no external dependencies or paid services.
Function
Section titled “Function”It takes the template (by template_id or inline), resolves {{data.field}} variables against the payload and draws the document. It always saves a copy to disk and, optionally, persists the document to serve it via a tokenized URL.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| template_id | Template selector | No* | Template saved in the Templates section. The + creates a new one. |
| output_format | Select | No | pdf (default), html or both. |
| output | Select | No | url (default): persist and return a link. base64: embed the document. |
| filename | Text | No | File name. Supports variables, e.g. sheet_{{data.reference}}. |
| ttl_hours | Number | No | Link expiry (URL mode only). |
| template_json | Textarea (advanced) | No* | Inline block template, if not using a saved one. |
* Requires template_id or template_json.
Output
Section titled “Output”URL mode (recommended)
Section titled “URL mode (recommended)”{ "document": { "url": "http://your-engine/d/doc/<token>", "token": "<token>", "path": "/local/path/to/file.pdf", "file_url": "http://your-engine/download/cli_2/file.pdf", "filename": "sheet_R-100.pdf", "mimetype": "application/pdf", "bytes": 24567 }, "filename": "sheet_R-100.pdf", "path": "/local/path/to/file.pdf"}document.url— a/d/doc/:tokenlink served by the engine (not the app). Keeps the workflow state small.document.path— local path of the generated file (for email attachments, FTP, etc.).document.file_url— direct download URL of the file on disk.
base64 mode
Section titled “base64 mode”{ "filename": "sheet_R-100.pdf", "mimetype": "application/pdf", "pdf_base64": "JVBERi0x...", "path": "/local/path/..." }Block template
Section titled “Block template”The template is a JSON with page, theme, header, footer and a blocks array. Block types: titleBlock, section, fieldGrid, table, text, image, qr, divider, pageBreak. Any block supports when (conditional). Full detail in the Document Generator guide.
{ "page": { "size": "A4", "orientation": "portrait", "margins": 40 }, "header": { "brand": "{{data.company}}", "title": "INVOICE", "refLine": "No. {{data.number}}" }, "footer": { "left": "Generated · {{now}}", "right": "Page {page} of {pages}", "pageNumbers": true }, "blocks": [ { "type": "section", "title": "Customer" }, { "type": "fieldGrid", "columns": 2, "fields": [ { "label": "Customer", "value": "{{data.customer}}" }, { "label": "Tax ID", "value": "{{data.tax_id}}" } ]}, { "type": "table", "from": "{{data.lines}}", "zebra": true, "columns": [ { "header": "Item", "path": "item", "width": 5 }, { "header": "Amount", "path": "amount", "align": "right", "width": 1 } ]} ]}Common combinations
Section titled “Common combinations”| Next node | Use case |
|---|---|
| sendMail | Attach the document (via path) or link url. |
| http | Return document.url as an API response. |
| ftp / s3 | Upload the generated file using document.path. |
| dataStore | Store the document link to look it up later. |
- The node runs in the queue worker. After engine changes, restart the worker so it picks up the new version.
document.urlpoints to the engine (where the/d/docroute lives), not the app.- Images: JPEG is embedded; the QR is drawn as a vector.
Related nodes
Section titled “Related nodes”- htmlTemplate — HTML rendering with variables (no native PDF).
- barcodeGenerator — generates barcode/QR images.
- sendMail — sends the document by email.