Template v2 Concepts
The template is the model based on which the PDF copy of an invoice, dunning reminder or account statement is rendered. It defines its contents and layout. The produced PDF document is intended to be distributed via email or postal service to customers, and it can be exported and archived. JustOn provides default templates, based on which you can define your own templates.
Version 2 of JustOn's PDF template mechanism is built around files written in the Liquid template language. To render the files and to produce the corresponding PDF output, JustOn uses a dedicated service based on the Chromium PDF engine. Use this approach if your business requires sophisticated PDF customizations that are difficult or impossible to implement with version 1 of JustOn's PDF template mechanism.
Be aware of the following restrictions:
- No external resources will be loaded (like image URLs).
- To embed assets (images, fonts etc.), you have to use data URIs. The assets must be encoded as base64 strings. For details, see Embedding Assets.
By default, backgrounds are not rendered. To control this behavior, use specific CSS styles per element:
No scripts can be run.
- The following tags are allowed:
- Consequently, the following tags are not allowed:
Usually, you have multiple templates that each serve a specific target. There are, basically, two ways to diversify templates:
- Creating multiple templates for different targets, for example, different locales or specific customer groups
- Using dedicated templates to customize specific parts for different purposes, for example, invoice, credit, cancellation.
You can combine the two approaches.
JustOn provides default Liquid templates for invoices, dunning reminders and account statements (in English) as well as for Swiss QR-code invoices (in English and German). Based on these files, you can define your own templates.
Example Liquid templates
When setting up a Subscription, Opportunity or any other object for billing, you must specify a standard template for that object. This template is then assigned by default to all invoices created from that object.
As long as an invoice has the status
Draft, you can assign another template to the invoice.