Skip to content

PDF Data Binding Guide

Data binding is how you inject dynamic content into your templates. You define variables in the editor, then pass real values through the API when generating a PDF.

In any text element, type a variable using double curly braces:

Hello, {{customer_name}}!
Your invoice total is {{amount}}.

You can also use variables in the Content field of images, barcodes, and QR codes — for example, {{product_image}} as an image source or {{tracking_number}} as a barcode value.

When you call the API to generate a PDF, include your data as key-value pairs:

{
"template_id": "your_template_id",
"data": {
"customer_name": "John Doe",
"amount": "$1,234.56"
}
}

Every {{variable}} in the template is replaced with the matching value from your data.

You can pass different types of values:

  • Text — "John Doe", "INV-2026-001"
  • Numbers — 1234.56, 42
  • URLs — "https://example.com/logo.png" (for dynamic images, QR codes)
  • Arrays — Lists of objects for dynamic table rows (see below)
  • Objects — Nested data accessible with dot notation (see below)

Use dot notation to access fields inside an object:

{{customer.name}}
{{customer.address.city}}

With this data:

{
"customer": {
"name": "Acme Corp",
"address": {
"city": "Paris"
}
}
}

When you pass an array, table rows repeat automatically for each item. Define your table row with array variables:

| {{items.description}} | {{items.qty}} | {{items.unit_price}} |

Then pass an array in your data:

{
"items": [
{ "description": "Widget A", "qty": 2, "unit_price": 15.00 },
{ "description": "Widget B", "qty": 5, "unit_price": 8.50 }
]
}

The table renders one row per item. See Tables for more on dynamic tables.

If a variable in your template has no matching key in the data, it renders as empty — no error is shown and no {{variable_name}} text appears in the output. This means you can safely have optional fields in your templates.

You don’t need to call the API to test your variables. Switch to the Preview tab in the editor and enter test data in the right panel. The preview updates automatically so you can see how your template looks with real values.

Use the Add missing key button to automatically generate placeholders for all variables found in your template.

  • Expressions — Compute values like totals and averages inside your templates
  • System Variables — Built-in variables for dates, page numbers, and more
  • API Reference — Full API documentation for generating PDFs