How to Create a New Document Template for Printing (for Admins)

We explain how to create and configure document templates for orders and shipments.
Written by Владислав Пономарь
Updated 2 days ago

If you need documents for customs, couriers, or customers, such as sales receipts, delivery documents, invoices, etc., you can create templates for them and print them when needed.

Ready-made templates can be copied from our document library and edited to suit your needs, or you can use them as a basis for creating your own templates with the necessary data.

How to create a template

Go to «Settings» → «Advanced» → «Document Templates», where you will see a list of created templates.

To add a new one, click «Add template»:

In the window that opens:

  1. Title — enter a name that is understandable to employees;

  2. Template type — select «Order»; if the template is only needed for deliveries, select «Deliveries»; if it is needed for pipeline cards, select «Pipelines»;

  3. Insert field — a list of all available variables that can be added to the template; they match the fields from the order, buyer, and company. When you click, the selected field variable is immediately added to the code and will be replaced with data from this field when the document is generated;

  4. Preview as PDF — click to see how the finished document will look when printed.

  5. Preview — click to quickly view the changes made to the code.

  6. Code input field — add the code for your document. HTML, CSS, and Twig are supported.

When you are ready, click the «Save» button. The created template will appear in the list and will be available for printing.

How to enter your data into a ready-made template

First, select and copy the template code from our document library. Delete all code from the input field and paste the copied code.

When viewing, you will see that some text is highlighted in yellow. You need to find it in the template code and replace it with your data. After that, the preview will display what you have entered:

Important! Whichever template you use, be sure to replace all text highlighted in yellow with your own information!

When everything is ready and you are sure that everything is displayed correctly, you need to remove the text highlighting, otherwise it will be preserved during printing.

To do this, find all lines style="background-color: yellow" and remove them:

After removing the highlight, open the preview to make sure that nothing is broken and everything is displayed correctly.

Click «Save» to add the template and save all the data you have entered.

How to add your logo, signature, and other images to a document

To add an image, you need to have a direct link to the file extension. Make sure that this link opens the image in your browser, for example: https://blog.keycrm.app/keycrm/images/keycrm-logo-blue-on-white.png.

You can get the link by:

  • Uploading the logo in the «Settings» → «General» section and copying it via the context menu.

  • Placing the image on your server or website.

  • Using photo hosting services, such as postimages.org.

Note! Links to images from Google Drive are not supported.

To insert an image into a document, use the following code:

<img src="https://blog.keycrm.app/keycrm/images/keycrm-logo-blue-on-white.png" style="width: 200px;">
  • src — link to the image (URL). Here you need to specify the path to your image;

  • style — style parameter, for example, width: 200px; sets the width of the image. You can change the value depending on your needs.

If you need to replace the image, replace the link inside the quotation marks in src="your link".

How to add document templates to the shipping service

Templates created with the «Delivery» type can only be printed after creating a waybill via KeyCRM.

To make them available, you need to add the delivery service you will be using. To do this:

  • Go to the settings of the integrated delivery service;

  • Open the «Documents» tab and select the required ones in the «Document templates» field.

Templates created with the «Order» type are also available for selection.

Important! If the document is for international shipping, be sure to fill in the sender's address in English in the shipping service settings.

Click «Save». From this point on, the selected documents will be available for printing for all new waybills created for this delivery service.

Template management

The list of templates displays their names and types. By clicking on the table column names, the list is sorted, and you can:

  1. Enable/disable a template by clicking on the switch in the “Status” column;
  2. Rename and make changes to the code by clicking on the pencil icon, which will open the same window as when creating a template;
  3. Delete an unused document template by clicking on the bin icon.

Using ready-made templates, available variables, and twig functions, you can customize your own document templates and print them during the process.

Tags: documents, document templates, invoice, bill, receipt, sales receipt, delivery note, expense report, print, document code, template code
Did this answer your question?