Skip to content

PDF templates

PDF templates allow you to customize the appearance of your PDF files for a given entity. When a PDF template is created, it will be used instead of the entity's default PDF template.

Composition

A PDF template is defined by a unique data and a content, which can be translated into multiple languages.

The data is the entity that your model is concerned with. For example, tasks, users, meetings, etc.

The content of the template is a chunk of code allowing you to model the structure of your PDF. In order to facilitate the layout of your template, it is possible to use the template language Liquid. The latter allows you to use variables, conditional branches, and other statements to create your model using a pseudo-language.

Case study

Here's an example of a valid template content for User data:

liquid
<table>
  <thead>
    <tr>
      <th>Email</th>
      <th>First name</th>
      <th>Last name</th>
      <th>Role</th>
      <th>Teams</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>{{ email }}</th>
      <td>{{ first_name }}</td>
      <td>{{ last_name }}</td>
      <td>{{ role.name }}</td>
      <td>
        {% for team in teams %}
          {{ team.name }}
        {% endfor %}
      </td>
    </tr>
  </tbody>
</table>