Skip to content


Cassiopeia provides support for templating / variable replacing. This allows you to place variables in your documents and replace them with actual values when generating a PDF. This is very helpful when generating serial letters or invoices.


Variables are defined using the {{$variable_name}} syntax in your document. The content between the braces is the variable name. For example, {{$foo}} is a variable named foo.

Variables can be used in any part of your document, including headlines, tables etc. You just can't mix formations within a variable. This comes due to the way these documents are persisted: As XML. Mixing formatings within a variable would produce a XML structure like <strong>{{$te</strong>st}}, which is invalid.

Replacing variables

When generating a PDF, you can replace the variables with actual values. This can be done by passing the values as JSON object within the request:

  "files": ["..."],
  "variables": {
    "foo": "bar",
    "test": "42"

This example will replace all occurrences of {{$foo}} with bar and {{$test}} with 42.