Template helpers
PDFox provides a fixed set of built-in Handlebars helpers. Custom helpers are not supported, and a template that uses any helper not listed here fails to generate. Transform data server-side before passing it as data if you need custom logic.
Formatting
| Helper | Example | Output |
|---|---|---|
formatCurrency value currencyCode [locale] | {{formatCurrency amount "GBP"}} | £1,200.00. Currency codes: GBP, EUR, USD, CAD, AUD, NZD, ZAR (anything else falls back to GBP). Locale defaults to en-GB, e.g. {{formatCurrency amount "EUR" "de-DE"}} → 1.200,00 € |
formatNumber value [decimals] | {{formatNumber qty 0}} | 1,235. Uses en-GB grouping; decimals defaults to 2 |
formatDate value | {{formatDate iso}} | 17 May 2026. Accepts an ISO 8601 string or timestamp; output is always DD Mon YYYY (e.g. 07 Jun 2026) |
uppercase value | {{uppercase name}} | ACME LTD |
lowercase value | {{lowercase name}} | acme ltd |
default value fallback | {{default reference "N/A"}} | N/A when reference is null or undefined. Other falsy values such as 0, false or "" are output as-is |
percent value [decimals] | {{percent rate 1}} | 12.3% for a rate of 0.123. The value is a decimal fraction (0.2 → 20.00%); decimals defaults to 2 |
Formatting helpers output an empty string when the value is not a valid number or date.
Arithmetic
| Helper | Example | Output |
|---|---|---|
add | {{add subtotal tax}} | Sum of two numbers |
subtract | {{subtract total discount}} | Difference of two numbers |
multiply | {{multiply qty price}} | Product of two numbers |
divide | {{divide total count}} | Quotient of two numbers; dividing by zero returns 0 |
Non-numeric arguments are treated as 0. Results are not rounded, so wrap them in a formatter: {{formatCurrency (multiply qty price) "GBP"}}.
Comparison (use inside {{#if}})
| Helper | Example | Meaning |
|---|---|---|
eq | {{#if (eq status "paid")}} | Strict equality (===) |
neq | {{#if (neq type "draft")}} | Strict inequality (!==) |
gt | {{#if (gt total 0)}} | Greater than |
gte | {{#if (gte qty 10)}} | Greater than or equal |
lt | {{#if (lt qty 10)}} | Less than |
lte | {{#if (lte balance 0)}} | Less than or equal |
gt, gte, lt and lte compare numerically (non-numeric values count as 0). eq and neq do not convert types, so "10" is not equal to 10.
Codes
| Helper | Example | Output |
|---|---|---|
qrCodeDataUri value | <img src="{{qrCodeDataUri payment.url}}" alt="QR code"> | QR code as an inline SVG data URI |
barcodeDataUri value [format] | <img src="{{barcodeDataUri order.ref "code128"}}" alt="Barcode"> | Barcode as an inline SVG data URI, with the value printed underneath. format is "code128" (default) or "code39" |
Block helpers
The built-in Handlebars block helpers {{#each}}, {{#if}}, {{#unless}} and {{#with}} are also available. See Handlebars syntax.
The template editor preview, the API and MCP previews and PDF generation all use the same renderer, so the helpers on this page are the complete list everywhere. Any other helper name is rejected in the editor as well as at generation time.
AI agents can call
list_template_helpers via MCP to get this list along with runnable examples — no need to hard-code it into prompts.