Skip to main content
Fileloom uses Handlebars as its templating engine. This guide covers the syntax you need to create dynamic PDFs.

Basic Output

Output variables using double curly braces:
With data {"name": "John", "orderNumber": "12345"}:

Nested Properties

Access nested object properties with dot notation:
With data:

HTML Escaping

By default, Handlebars escapes HTML characters for security:
Input: <script>alert('xss')</script> Output: &lt;script&gt;alert('xss')&lt;/script&gt; To output raw HTML (use carefully):
Only use triple braces {{{ for HTML you trust. Never use it with user-generated content.

Conditionals

Simple If

If-Else

If-Else-If

Falsy Values

{{#if}} treats these as false:
  • false
  • undefined
  • null
  • "" (empty string)
  • 0
  • [] (empty array)

Unless (Inverse If)

Loops

Each

Iterate over arrays:
With data:

Loop Variables

Inside {{#each}}, special variables are available:

Empty Arrays

Handle empty arrays with {{else}}:

Iterating Objects

Loop through object properties:
With data {"person": {"name": "John", "age": 30}}:

Using Helpers

Helpers transform or format data:

Common Helpers

See Helpers Reference for all 70+ helpers.

Comments

Add comments that won’t appear in output:

Whitespace Control

Control whitespace with ~:
The ~ removes whitespace on that side of the tag.

Partials (Reusable Snippets)

While Fileloom doesn’t support custom partials, you can achieve reusability with:
  1. CSS classes for consistent styling
  2. Helper functions for data transformation
  3. Template duplication for similar documents

Practical Examples

Invoice Line Items with Totals

Conditional Sections

Address Formatting