Configuring v3 Templates
The v3 PDF renderer produces archivable PDF/A output for Liquid templates and is the required engine for ZUGFeRD/Factur-X e-invoices. This article describes the basic setup of a v3 template.
Note
Be aware that creating and modifying Liquid templates requires profound skills in web development techniques, in particular, Liquid template language and Cascading Style Sheets (CSS).
Creating and maintaining Liquid templates constitutes custom development. Related issues are therefore not covered by the general maintenance and support contract for JustOn.
Info
v3 and v2 use the same Liquid template files. If you are migrating an existing v2 template, be aware that some CSS and fonts render differently under v3. For details, see Differences From v2.
Default v3 Templates
JustOn Billing & Invoice Management ships three default v3 (Liquid) invoice templates – one each for English (DefaultV3EN), German (DefaultV3DE) and French (DefaultV3FR) with a corresponding Liquid file attached and the PDF Renderer field already set to v3. You can use them as a model or reference when defining your own template according to your use case and corporate identity.
Configuring v3 Template Rendering
Preparing a template to use the v3 PDF renderer involves the following steps:
-
Create a new template, clone an existing template, or open an existing template.
If you clone one of the default v3 templates, the
PDF Rendererfield is already set tov3and the v3 Liquid file is already attached. In this case, you can skip steps 2 and 3. -
In the Layout & Design section, click next to the
PDF Rendererfield and specify the valuev3. -
Attach the required Liquid template files.
In the Notes & Attachments area, click to open the action menu, select Upload Files, then proceed as prompted.
This operation requires the custom
Typefield (ONB2__Type__c) to be available on the page layout of the Content Version object. For details about adding fields to page layouts, see Modifying Page Layouts or Search Layouts.Make sure to set the
Typeof the uploaded files toLiquid Template. -
Optionally, adjust PDF rendering options.
In the Layout & Design section, click next to the
PDF Optionsfield and specify options for the PDF output as required. The field value is in JSON notation, like{ "locale": "de-DE", "currency": "EUR", "currencyDisplay": "code" }For the available properties, see PDF Options.
-
Click Save to apply your template customization.
PDF Options
The PDF Options field controls locale, currency and number formatting for the v3 render, as well as rendering behavior. The field value is in JSON notation.
| Property | Description |
|---|---|
locale |
Sets the BCP 47 language code. Defaults to en. |
currency |
Sets the ISO 4217 currency code (for example, EUR). Required for the currency filter. |
currencyDisplay |
Defines the currency display format. Possible values: code, symbol, name, narrowSymbol. |
useDigitGrouping |
Toggles the digit group separator. Possible values: true (default) or false. |
minimumFractionDigitsmaximumFractionDigits |
Sets the minimum (default 0) or maximum (default 3) number of decimal places, applying to the decimal, currency and percent Liquid filters. |
escape |
Toggles HTML escaping for the whole document. Escaping is on by default; set false to disable it. To output HTML for a single value instead, use the html filter. |
strict |
If true, turns rendering-engine warnings into hard errors – useful while validating a migrated template. |
The field value is in JSON notation, like
{
"locale": "de-DE",
"currency": "EUR",
"currencyDisplay": "symbol",
"useDigitGrouping": true,
"minimumFractionDigits": 2,
"maximumFractionDigits": 5
}
JustOn recommends to set at least the locale property.
The formatting properties are applied in the Liquid file through the corresponding filters: {{ value | decimal }}, {{ value | currency }} (requires locale and currency), {{ value | percent }} (requires locale), and {{ value | money }} (for objects with amount and currency properties). For details, see Using Custom Liquid Filters.
Defining Headers, Footers and the Page Counter
Unlike v2, the v3 renderer does not use the template Page Header and Footer record fields through the engine. In v3, page headers, footers and page counters are defined in the Liquid file using print CSS – @page margin boxes together with the counter(page) and counter(pages) functions.
For example, to render a running footer like Invoice Page 1 of 2, add the following to the <style> block of the Liquid file:
@page {
size: A4;
margin: 2cm 1.5cm 3cm 2.5cm;
@bottom-center {
content: "Invoice Page " counter(page) " of " counter(pages);
}
}
The shipped default v3 templates already define a page counter this way. Adjust the content string to localize it, for example, content: "Seite " counter(page) " von " counter(pages);.
For details on working with Liquid files, see Working With Liquid Code.
Document Metadata
The v3 renderer writes PDF document metadata from the Liquid file:
- the PDF title from the
<title>element (or<meta name="title">), author,subjectandkeywordsfrom the corresponding<meta>tags.
Template Field Usage in v3
Because structure and styling live in the Liquid file, most Template record fields are ignored by v3. The record still controls localized text, text blocks, locale/format settings, and a few feature gates:
| Category | Used by v3 |
|---|---|
| Localized labels | Subtotal/tax/discount labels, discount message, tax-table and outstanding-invoices intro texts, and the Override Labels map ({"v3": {...}}) for all remaining labels. |
| Free-text blocks | Greeting (Text 1), closing and pre-closing blocks (Text 2, Text 3), installments and reverse-charge notices, and the payment-info blocks. |
| Locale/format | Language, date/time and number-format fields, Custom CSS, Use Unicode Font, PDF Renderer, PDF Name, PDF Options. |
| Feature gates | Tax Table, Add QR Code, Outstanding Invoices. |
| Line-item table | Table Columns, Category Criterion/Category Label, Subtotal Criteria, and the no-subtotal gates – the line-item table is the one structure still built server-side. |
Info
All other fields – header/info blocks, balance/installment/tax-table columns, address fields, and fields belonging to the email, dunning or deposit flows – have no effect on the v3 invoice PDF. On the shipped default templates, unused free-text fields are filled with a NOT USED FOR V3 (LIQUID) TEMPLATES note so you can see at a glance which fields have no effect.
Related Tasks
Configuring a v3 template can involve the same additional tasks as any other Liquid template – specifying a counter, default payment due, payment reference text, and the invoice email. For details, see Configuring Liquid Templates.
For the ZUGFeRD-specific setup, see Configuring ZUGFeRD E-Invoices.