Skip to content

Variables

A variable is a named placeholder in a template. It gets a new value each time you generate a PDF.

The Variables panel

Click Variables at the top right of the editor. The panel lists the template’s variables with their type, default and limits. You can search them by name, edit one with the pencil, delete one with the trash icon, or create one with Add Variable.

  1. Click Variables → Add Variable.

  2. Give it a Name: letters, digits and underscores, not starting with a digit (customerName, invoice_number, total2), and unique within the template. Your code and your AI agents send values under this name.

  3. Pick its Type:

    Type Holds
    String Text: a name, a date, an amount, a paragraph
    Boolean True or false: shows or hides a block (the if)
    Image A PNG or JPEG: a photo, a logo
    List A list of items, each with the same fields (the for)
  4. Switch Required on if a PDF must never be generated without it.

  5. Set the options of its type:

    • a string’s Max Length, the most characters a value may have;
    • a list’s Max Items and Item Fields: one row per field, with a name, a type (string, boolean, image or list), a max length or max items, and Required when every item must give it a value. A field of type list declares its own fields, for lists in lists.
  6. Give it a Default Value, used whenever an export doesn’t send one: a text, a switch, an image, or for a list a table with one row per item. A required variable has no default.

  7. Click Create.

Each type is bound in its own place:

Type Bound to How
String A text box Caret in the text, then Variable (⚡) in the text bar
Boolean Any shape, a group, a page Show in its context bar → the variable → When true or When false
Image An image box Choose image → Variable tab
List A group, or a page Repeat in its context bar → the list

Inside a repeated group or page, the pickers also offer the fields of the current item, named after the list: lines.label, lines.photo, lines.inStock.

The canvas marks bound shapes with a badge: ⟳ for a repeat, the eye for a condition, a picture for an image variable. The editor never shows values. A string appears as a chip with its name, a repeated group shows one copy, and a shape that the default values would hide is faded. Use Preview to see the document with values.

These recipes walk through each binding:

When a PDF is generated, each variable takes the value sent for it. If no value is sent, or the value is an empty string or an empty list, the variable takes its default. Without a default, it stays empty.

Variable setup No value sent Value sent
Required ❌ The export fails The value
Optional with default The default The value
Optional, no default Empty text, empty image box, no copy of a repeated group The value
  • Edit a variable with the pencil in the panel. Renaming doesn’t break the template, since shapes keep their bindings, but your code sends values by name, so update it at the same time.
  • Delete a variable with the trash icon. You can’t delete a variable that is still used somewhere (in a text, an image box, a condition or a repeat, on any page). Remove its uses first.

Values are sent by name, as JSON:

{
"customerName": "Michael Scott",
"discount": true,
"logo": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…",
"lines": [
{ "label": "A4 copy paper", "price": "€85.00" },
{ "label": "Letterhead", "price": "€120.00" }
]
}

Strings are inserted as they are, so format dates, amounts and numbers in your code ("€1,250.00", not 1250). See Variable values for every type.