How to create a new document template for printing (for administrators)

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

If you need documents for accounting, couriers, customers, such as contracts, invoices, receipts, 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 examples to create 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 title that is understandable to employees;

  2. Template type — select «Pipeline»;

  3. Insert field — a list of all available variables that can be added to the template; they correspond to the fields from the pipeline, customer, and company cards. 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.

Note! Be sure to select the template for pipelines, as the variables for orders are different and will not work in pipelines. You can replace the variables and remove unnecessary ones in the template for orders and use it in pipelines if necessary.

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 entered:

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

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 delete 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 with the 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 suitable.

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”.

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 a document template that is not in use by clicking on the trash can icon.

Using ready-made examples, available variables, and Twig functions, you can customize your own document templates and print them during operation.

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