I am using qz-tray(A middle ware to make printing from browser with printer attached on the USB port of client's machine) to print my POS reciepts. I am using PostScriptPrinting for generating reciepts and for PostScriptPrinting I am using printHTML function of qz-tray. What I understand is that qz-tray uses java Html Renderer to render and generate reciepts for printHTML function. It was running good on my machine but my client's machine is a macbook, and he had installed bootcamp windows on it. When I generated print from macbook's bootcamp windows, the reciept's formatting got disturbed. What can be the reason behind this? How can I solve this issue?
1 Answers
What I understand is that qz-tray uses java Html Renderer to render and generate reciepts for printHTML function.
Correct, QZ Tray 1.9 used the very limited internal Java HTML renderer.
When I generated print from macbook's bootcamp windows, the reciept's formatting got disturbed. What can be the reason behind this? How can I solve this issue?
Likely a difference in the printer driver, which means your answer requires more information (such as which printer and printer driver you are using).
For example, if this receipt printer is Epson, the driver must be installed and driver settings can influence the output quality. Epson offers drivers for MacOS, Linux and Windows.
Furthermore, depending on the QZ Tray version 1.9, 2.0, 2.1, etc, Java 7 + HTML can have considerably different results over Java 8 + HTML.
Regardless, the PostScript
printing has been deprecated in the later versions of QZ Tray, so utilizing the latest version should yield better results.
var config = qz.configs.create("Printer Name");
var data = [{
type: 'html',
format: 'file', // or 'plain' if the data is raw HTML
data: 'assets/html_sample.html'
}];
qz.print(config, data).catch(function(e) { console.error(e); });
For best HTML quality on a thermal printer, QZ Tray 2.1 or higher is recommended.

- 7,103
- 6
- 40
- 101