Skip to content

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.

Limitations

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:

    -webkit-print-color-adjust: exact;
    
  • No scripts can be run.

  • The following tags are allowed: a, abbr, acronym, address, area, article, aside, b, base, basefont, bdi, bdo, big, blockquote, body, br, button, canvas, caption, center, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, dir, div, dl, dt, em, fieldset, figcaption, figure, font, footer, form, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, img, input, ins, kbd, label, legend, li, link, main, map, mark, meta, meter, nav, noframes, noscript, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, section, select, small, source, span, strike, strong, style, sub, summary, sup, svg, table, tbody, td, template, textarea, tfoot, th, thead, time, title, tr, track, tt, u, ul, var, wbr.
  • Consequently, the following tags are not allowed: applet, audio, embed, frame, frameset, iframe, object, script, video.

Template Variation

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.

Info

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

Invoice Template (English)
Dunning Template (English)
Account Statement Template (English)

Swiss QR Code Invoice Template (English)
Swiss QR Code Invoice Template (German)

Template Assignment

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.