• The basics for creating your own pdf templates
  • How to create a pdf property with variables
  • The different pdf actions

Basic PDF templating

PDF's use PrinceXML to generate content. This includes a mix of html, css and liquid.

You can look at examples and templates on the official princexml website here.

The setup of an pdf file is just like a regular html page:


You can add page settings in the styling:

      @page {
        size: A3 landscape;

In the above code the size of the paper is set to A3 in landscape. You can also add content to specific areas of a page:

      @page {
        size: A4 portrait;
        @bottom-right { content: counter(page); }

In the above example a page-number is placed in the bottom right of every page.

You can still add regular css in the styling as well:

      @page {
        size: A3 landscape;
        @bottom-right { content: counter(page); }
      table {
        border-collapse: collapse;
      th {
        padding: 3px;
      td {
        padding: 3px;
      p {
          color: grey;

PDFs use tables to align information.

        Column header 1
        Column header 2
        content 1
        content 2

You can use liquid to dynamically load data into the table.

    {% for line in invoicelines %}
    {% endfor %}     

In the above example a collection of invoicelines is loaded into the table.

PDF File property

You can add PDF File properties to you model just like any other property. The property has the following settings:

Select a pdf template which will be used to generate the pdf. You can also pick new which will create a new empty template.

Dynamic Template
This allows you to use a condition to set a template. A template is set in this field using the UUID of the template. You can find the UUID in the url when you open the template. Example condition: If A == 1 then template X, else template Y.

Allow regenerate
This allows you to regenerate your pdf file after it has already been generated before. This is useful when data for the file is subject to change.

Allow remove
This allows you to delete a pdf file from a record after generation.

This allows you to set the name of the pdf file. If you set MyPDF as filename it will show MyPDF.pdf as file when you download / open it.

Most pdf templates use variables to set data. You will have to assign these variables on the property for the template to be able to use them.

Creating a PDF File property

PDF actions

There are 2 actions that use pdf properties. Pdf generate and Pdf merge. This is how to use them:

PDF Generate

  • Object

The object which has the PDF property you want to generate. Usually var:record.

  • Property

The Pdf file property of the selected model you want to use.

  • Regenerate

Allows the action to regenerate the pdf file if the action is started multiple times for the same record. This only works if regeneration is set to true on the pdf property.

  • Run in background

Runs the action in the background. This allows for multiple generate actions to be executed at the same time but it can take a while before the file shows up. If you are using the generated PDF directly after the action you shouldn't use background, because the PDF won't be ready when the next action (event) is triggered.

  • Password

Set a password which is needed to open the PDF file after downloading. Can be defined as a set value or by a variable.

PDF Merge

  • Collection

A collection of records with a PDF file which you want to merge together. (You can create a collection as a variable in the action)

  • Property

The PDF file property you want to use.

  • Description

A field to describe what you are merging.

  • Filename

The name of the new PDF file

  • Store as download

Allows you to set the file in the download tab in the back-office of your application.

  • Password

Set a password which is needed to open the PDF file after downloading. Can be defined as a set value or by a variable.

  • As

The name of the file to be used as variable later in the action.

Did this answer your question?