Raw Printing
Raw Printing is when you send a string of commands to a printer in its own language, without using printer drivers.
This method is often used for thermal printers that need raw command inputs to do things like:
- Printing barcodes
- Printing receipts
- Printing labels
- Cutting paper
- Opening the cash drawer
Raw Printing is faster and more reliable than other methods because it doesn't use drivers. This is especially true for POS systems.
1. How to set up Raw Printing in ERPNext
1.1 Putting the QZ Tray app on the client's computer
Install the QZ Tray app on the computer that is connected to your thermal printer to get started with Raw Printing. The official QZ Tray website has a link where you can get it.
Operating Systems That Are Supported:
- Windows
- macOS
- Linux
1.2 Make a print format for raw commands
You need to make a print format in ERPNext using raw commands before you can send raw commands to the printer. Just like HTML print formats, these print formats use the Jinja Templating Language.
How to make a Raw Commands Print Format:
Go to: Home > Settings > Printing > Format for Printing
Press New
Choose the right DocType, like "Sales Invoice."
Check both choices:
Custom format
Raw Printing
Type the printer-specific raw language commands into the Raw Commands field.
Press Save

1.3 Turn on Raw Printing in the Print Settings
To turn on Raw Printing for everyone:
Go to: Home > Settings > Printing > Print Settings > Raw Printing
Check the box that says "Enable Raw Printing."
Click on Save.
2. Ways to Use Raw Printing in ERPNext
There are two main ways to start raw printing in ERPNext:
2.1 Clicking Print on the Print View Page
From the print view of the document:
Choose your Raw Print Format. You will see No Preview available because raw commands don't show a preview.
Press the Print button
QZ Tray will show you a connection prompt.
What is the purpose of printer mapping?
It connects the chosen print format to a certain printer
You need to install your printer on the client machine.
Each client's device saves the mapping locally.
You can also manage it later by clicking the Printer Settings button.
This makes sure that the right printer gets the raw command for every print job.
2.2 How to Call Raw Print Functions from a Client Script
You can automate raw printing by calling print functions from a client script, like when you click Submit, Save, or Amend.
These are the main functions:
Important:
You can also use the qz object to access QZ Tray's built-in methods.
You can only initialise the qz object after you call frappe.ui.form.qz_connect.
Use frappe.ui.form.qz_init if you need it sooner.