User Guide For Printing Templates
The templating system for Paimnt printers is built to be as customisable as possible. As such, it can also become complicated as you try to do more advanced things. This page is here to give you all the building blocks you need to make a simple print template to your liking.
Variables
Variables are the most fundamental factor of a print template.
Depending on where you create your template you will have different variables available for use.
For example if you are creating a template for a docket you will have the saleDate and saleTime variables available.
Variables can be used in a template by either wrapping the template name in {{nameHere}} or {{{nameHere}}}.
Let’s make a simple template with the saleDate and saleTime variables
Template
The date is {{saleDate}} and the time is {{{saleTime}}}Output
The date is 12/02/2024 and the time is 12:55:00 PMNested variables
Sometimes a variable is nested inside another variable. This helps us organise variables so they are easier to distinguish from one another. Nested variables can be navigated to by using a period. Let’s make a template with nested variables. First let’s define what those variables would theoretically be.
Variables
"sale": {
"customerName": "Oscar",
"saleAmount": "$12.70"
},
"saleDate": "12/02/2024",
"saleTime": "12:55:00 PM",Template
Date: {{saleDate}}
Time: {{saleTime}}
Customer: {{sale.customerName}}
Total: {{sale.saleAmount}}Output
Date: 12/02/2024
Time: 12:55:00 PM
Customer: Oscar
Total: $12.70
Arrays
An array is a way of representing multiple variables under a single variable. Think of it like a nested variable but instead of a single nested set of variables is can have multiple. Nested variables are accessed in a different way to the others. They use the following format:
{{#array}}
Use array here
{{/array}}Notice that there is an opening clause ({{#array}}) and a closing one ({{/array}}).
This means that anything between these two clauses is able to access the array content.
Caution
Arrays do not accept {{{}}} (triple brackets) in their opening and closing clauses
This is a concept easier to explain in practice to let’s make a print with arrays!
Variables
"sale": {
"customerName": "Oscar",
"saleAmount": "$12.70",
"items": [
{
"name": "Chips",
"quantity": 2,
},
{
"name": "Garlic Bread",
"quantity": 1,
}
]
},
"saleDate": "12/02/2024",
"saleTime": "12:55:00 PM",Template
Date: {{saleDate}}
Time: {{saleTime}}
Customer: {{sale.customerName}}
{{#sale.items}}
{{quantity}} {{name}}
{{/sale.items}}
Total: {{sale.saleAmount}}Output
Date: 12/02/2024
Time: 12:55:00 PM
Customer: Oscar
2 Chips
1 Garlic Bread
Total: $12.70
Formatting
For formatting a print we have special variables that can be used to instruct a printer to format text a certain way. Now that you have the concept of variables down pat we can jump straight into an example!
Note
You will see us use "print code" below. This is not the actual value of the variable as the actual value is a binary code.
Variables
"emphasizeon": "print code",
"emphasizeoff": "print code",Template
This text is normal.
{{emphasizeon}}This text is bold!
{{emphasizeoff}}This text is back to normal.Output
This text is normal.This text is bold!
This text is back to normal.
Functions
For even more advanced functionality we have functions. These are ways of communicating directly with the Paimnt code to process calculated results. This can be used for many things, from full width lines to images. We can even pass a parameter into a function to tell Paimnt how to render properly.
You can call to functions similarly to how you access arrays:
{{#function}}
parameter here
{{/function}}Caution
As with arrays, functions do not accept {{{}}} (triple brackets) in their opening and closing clauses
Let’s look at how this can be used.
Note
As above in the formatting section, you will see us give a value to a variable. This is not the real value and is simply a placeholder.
Variables
"image": "function with image name as parameter",
"hr": "function with no parameter"Template
{{#hr}}{{/hr}}
{{#image}}
logo
{{/image}}
{{#hr}}{{/hr}}Output

Default variables and functions
Now that you know how to use variables and functions, I will give you the default ones.
Variables
Format variables:
init- Initialises print by clearing old codeslineSpacing- Use 9/203 inches line spacinglineSpacingDefault- 30/203 inches by defaultlineFeed- Print a line feedprintAndFeed- Print and paper feed 4 x motion unitsprintAndFeedLines- Print and feed 3 linesalignLeft- Changes align mode to leftalignCentre- Changes align mode to centrealignRight- Changes align mode to rightnormal- Resets double width and double heightdoubleHeight- Sets text to double heightdoubleWidthHeight- Sets text to double width and double heightcutPartial- Performs a partial paper cutcutFull- Performs a full paper cutopenCashDrawer- Opens the cash draweremphasizeon- Turns on bold text modeemphasizeoff- Turns off bold text mode
Functions
Format is functionName() for a function with no parameters and functionName(parameter) for a function with parameters.
spacer(spacerSpecifier)- Creates a spacer for the remaining paper width.spacerSpecifiermust be the number of characters to the left of the spacer, a colon, and then the number of characters to the right of the spacer (e.g “12:4”)hr()- Creates a line that is the full width of the paperimage(imageName)- Creates an image with thealignCenterformat.imageNamecan only currently be “logo” (the Paimnt logo)
Next steps
Congratulations, you’ve reached the end of the printing templates user guide!
You now have the basic concepts that you need to create printing templates for your business.
To further your knowledge you can visit the Technical Guide. This is a much more advanced guide and is tailored for technologically seasoned users.