Skip to content

Print Templates ​

A print template decides how a document looks on paper or in a PDF: your logo and address, which columns the item table has, the totals, the notes at the bottom. Hicom Books comes with ready-made templates, and you can design your own in the Template Builder.

Computer only

The Print Templates list and the Template Builder do not open on a phone. Printing documents works on a phone too.

  1. Open a saved document, such as a sales invoice.
  2. Click the printer icon (Open print view) in the page header. On a computer, Ctrl + P (Cmd + P on macOS) does the same.
  3. If you have more than one template for this document type, choose one in Template Name.
  4. Click Save as PDF to download the file, or Print to open your browser's print dialog.

Print view of a sales invoice from Kopi Rempah with logo, address, three items, tax and the total in words

Things to know:

  • A cancelled document, or one with unsaved changes, cannot be printed. Save first.
  • The printer icon appears only if at least one template exists for the document type.
  • Print opens a new browser tab. If you see Pop-up blocked, allow pop-ups for your Hicom Books site and try again.

Ready-made templates ​

DocumentTemplate
Sales invoiceBusiness - Sales Invoice
POS saleBusiness-POS - Sales Invoice (narrow receipt)
Sales quoteBusiness - Quote
Purchase invoiceBusiness - Purchase Invoice
PaymentBusiness - Payment
ShipmentBusiness - Shipment

Ready-made templates cannot be edited or deleted. To change one, duplicate it and edit the copy.

Journal entries, purchase receipts and stock movements have no ready-made template. Create one before you print them.

The ready-made templates take your company details from the print settings.

  1. In the sidebar, click Setup > Settings.
  2. Click the Print tab.
  3. In Logo, upload your logo.
  4. Turn on Display Logo in Invoice.
  5. Check Company Name, Email, Phone and Address, and pick a Color.
  6. Click Save.

The Font you choose here applies to all templates. See Settings.

Choose the default template ​

The print view opens with the default template of each document type. Set the defaults on the Defaults tab of the settings, in Print Templates, for example Sales Invoice Print Template or Shipment Print Template. POS sales use the POS Print Template of the POS profile they were made with, or else the one on the Defaults tab.

Who can change templates ​

Only a user with the System Manager role can create, edit or delete templates, because a template can read any data in your site. Everyone else can print with the templates and open them in the Template Builder to look, but cannot change them.

Create your own template ​

  1. In the sidebar, click Setup > Print Templates.
  2. Click New. The Template Builder opens with a short sample template.
  3. In the page header, enter the Template Name. It cannot be changed after you save.
  4. In the bar below the preview, choose the Template Type, such as Sales Invoice or Shipment.
  5. Choose a document in Display Doc to preview with. Hicom Books suggests the latest one.
  6. Edit the template on the right.
  7. Press Ctrl + Enter, or click outside the editor, to update the preview.
  8. Click Save.

Two quicker starts:

  • To change a ready-made template, open it and click ... > Duplicate. The copy has CPY added to its name.
  • From the print view of any document, click More > New template (empty sample) or More > Duplicate template (a copy of the template on screen). The new template already has the right Template Type.

Template Builder with a sales invoice preview on the left, the template code on the right, and Key hints open below the editor

Working in the Template Builder ​

KeyAction
Ctrl + EnterApply your changes to the preview
Ctrl + S (Cmd + S on macOS)Save. Unapplied changes are applied first.
Ctrl + EEdit mode on or off. Edit mode widens the editor and hides the sidebar.
Ctrl + HShow or hide Key hints

Use Ctrl for all keys except saving, also on macOS.

If the template has a mistake, the preview shows Template error with the line and the problem.

The ... menu in the header also has:

  • Set print size: choose a Page Size such as A4 (default), A5, Letter or POS, or a custom height and width in cm. Save the template afterwards.
  • Set template type: change the document type the template is for.
  • Save template file: download the template as a file, to keep a copy or share it.
  • Select template file: replace the editor's content with a template file.
  • Delete: remove the template. Ready-made templates cannot be deleted.

Writing a template ​

A template is HTML with placeholders. The quickest way to learn is to duplicate a ready-made template and change it a little at a time.

  • {{ ... }} shows a value, for example {{ doc.name }}.
  • {% ... %} controls the layout, for example repeating a row for each item or showing a block only when a setting is on.
  • Add CSS in a <style> block or in style attributes.

Values you can use ​

NameContents
docThe printed document: doc.name, doc.date, doc.party, doc.grand_total, its doc.items, and so on. The fields depend on the Template Type.
printThe Print settings: print.company_name, print.logo, print.address, print.color and the display switches. Load them first with {%- set print = get_print_settings() -%}.
totalsTotals the document does not store: totals.sub_total and totals.grand_total_in_words, plus payment details on invoices. Load them with {%- set totals = get_print_totals(doc) -%}.

Click Key hints below the editor to see every doc and print value for the template type, including your custom fields. The editor also suggests names as you type inside {{ }}.

A table, such as the items, appears in Key hints as a list. Repeat a block for each row:

html
{% for row in doc.items %}
  <tr>
    <td>{{ row.item | e }}</td>
    <td>{{ row.quantity }}</td>
  </tr>
{% endfor %}

Add | e after text that people type, such as item names and notes, so that characters like < print as text.

The display switches in the print settings, such as Display Logo in Invoice, only take effect if your template checks them, for example:

html
{% if print.display_logo %}
  <img src="{{ print.logo }}" style="height: 60px">
{% endif %}