PDF templates
Last updated
Was this helpful?
The PDF template class generates PDF documents by merging App data with layouts designed in the PDF Template Editor. Each template operates as an instance that contains the fillTemplate function for its layout. This class requires an instance. The code class name is PdfTemplate.
fillTemplateMerges data with the pre-designed layout and generates a completed document.
values
A data object containing key-value pairs. The keys must exactly match the variable names configured for placeholders in the PDF Template Editor (such as firstName or orderDate). Supports nested objects.
object
options
showEmptyVariables
Displays the variable name in angle brackets (such as <firstName>) for placeholders without a value. If false, leaves them empty. Default false.
boolean
Returns the populated PDF document as a base64-encoded string. If rendering fails, the function returns nothing and the error appears in the log. During development, the function node displays a preview of the rendered PDF layout. Store the output in a database, display it in a media view widget, or send it as an email attachment.

Each execution generates a new document and populates the entire template in a single operation. For templates with multiple fields, assemble the required data into a single structured object before passing it to the function.
Fill template layout
See the step-by-step tutorial to build a dynamic acceptance report from start to finish:
Last updated
Was this helpful?
Was this helpful?
# values
name: John
surname: Doe
signature: iVBORw0KGgoAAAANSUhEUg...
# options
showEmptyVariables: true