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. Produced PDF documents are intended to be distributed via email or postal service to customers, and can be exported and archived.
Combining data with a template to produce an output
In addition to the fields that are printed to the PDF, the templates also include texts for the email that JustOn sends to distribute the rendered PDF documents.
JustOn provides a default template (named
Default), 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.
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 both dedicated Liquid files (attachments to the template record) to customize specific parts of the resulting PDF files for different purposes, for example, invoice, credit, cancellation, and dedicated template detail records to customize email texts or counters for specific purposes (see Common Approach).
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 usually specify a standard template for that object. This template is then assigned by default to all invoices created from that object.
If the source record does not specify a template, JustOn uses the one set on the related account. In case the account has not set a template either, JustOn falls back to the
As long as an invoice has the status
Draft, you can assign another template to the invoice.
JustOn provides default Liquid template files for invoices, dunning reminders and account statements:
|Liquid Template Title||Used for|
||invoices, credits, cancellations, pro forma, deposit|
||all dunning levels|
In the simplest approach (no locale-specific variation, etc.), you have one template record to which are attached the Liquid template files, as well as are associated the template detail records to cover your use cases. Now depending on the use case, JustOn uses the template record, the Liquid file attachment or the associated template detail to produce the PDF file and the email.
Example use cases
Your business may, however, need to cover more complex scenarios, like multiple locales, different customer groups, etc. In this case, you double this structure: You create a second (third, etc.) template record intended for the specific purpose, and attach the corresponding specific Liquid template files and associate the relevant template detail records.
|Use Case||Data Category||Data Origin|
|Invoice||PDF layout and standard texts||Invoice Liquid template|
|Email standard texts||Template record|
|Credit||PDF layout and standard texts||Invoice Liquid template|
|Email standard texts||Credit template detail record|
Optionally, if different from invoice counter
|Credit template detail record|
|Cancellation||PDF layout and standard texts||Invoice Liquid template|
|Email standard texts||Cancellation template detail record|
Optionally, if different from invoice counter
|Cancellation template detail record|
|Dunning reminder||PDF layout and standard texts||Dunning Liquid template|
|Email standard texts||Dunning template detail record|
|Counter||Dunning template detail record|
|Account statement||PDF layout and standard texts||Account statement Liquid template|
|Email standard texts||Account statement template detail record|
|Counter||Account statement template detail record|
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: