Self-Signed Certificate Support in QZ Tray

78 views
Skip to first unread message

Mykhailo Zinchuk

unread,
May 21, 2025, 6:31:18 PMMay 21
to qz-p...@googlegroups.com

Dear QZ Tray Support,

I'm using QZ Tray with a Node.js app and connecting via secure WebSocket.The connection works without signing but fails with self-signed certificates, showing a 1006 - Session Closed error and:

Error: Unable to establish connection with QZ at deeper (/path/to/node_modules/qz-tray/qz-tray.js:113:40)

Does QZ Tray support self-signed certificates for secure WebSocket connections or i should use only paid certificate from your site? If so, can i buy only cert, without any plan?

Thank you, Mykhailo Zinchuk

Lite Finocchiaro

unread,
May 21, 2025, 6:48:03 PMMay 21
to Mykhailo Zinchuk, qz-p...@googlegroups.com
Mykhailo:

Does QZ Tray support self-signed certificates for secure WebSocket connections

Yes, but not all self-signed certificates are the same, and you also need the private key if you want signing to work.

Did you generate your self-signed cert and private key using the QZ-Tray client? If not, please try this method and let us know if it works:


Cheers,

Lite Finocchiaro
VP, QZ Industries

--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/qz-print/CAPCtFwRz%3DOoWGt4JNSw%2B08x_7VzX3AUrYGqAjSa5b-_uZKjSVw%40mail.gmail.com.

Mykhailo Zinchuk

unread,
May 27, 2025, 4:46:59 PMMay 27
to Lite Finocchiaro, qz-p...@googlegroups.com
Thank you for your quick answer. It worked.

Can you also maybe tell how to fix problem whil printing image? One time it was ok, and printed without spaces in letters. But all next times it looks like this:

image.png

I use node.js, 

and have such code. Tried different params like density, and other from your doc, but does not help. Printer is ok, cause with other lib it works fine(node-thermal-printer).

let config = qz.configs.create('ReceiptPrinter');
let data = [
{
type: 'raw',
format: 'image',
flavor: 'base64',
options: { language: 'escp', dotDensity: 'double' },
data: base64Image,
},
'\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A',
'\x1B' + '\x69',
]; // after connection
await qz.print(config, data).catch((e) => console.error(e));

Thanks in advance!

чт, 22 трав. 2025 р. о 01:48 Lite Finocchiaro <lite.m.fi...@gmail.com> пише:

Lite Finocchiaro

unread,
May 27, 2025, 11:28:34 PMMay 27
to Mykhailo Zinchuk, qz-p...@googlegroups.com
Mykhailo:

Did you power cycle the printer before switching between QZ-Tray and node-thermal-printer? I ask this because we may achieve our raw image printing in different ways, and if there are conflicting ESC/POS commands, then this could give undesired results. 

Sometimes adding the "init" command before an ESC/POS command string can help clear any remaining configurations from previous prints, instead of turning the printer off and on.


I also noticed that you use "ESCP" instead of "ESCPOS", but this should not make a difference in this particular case.

Here is a copy/paste of QZ-Tray logs of the raw image test from https://demo.qz.io to an Epson TM-T88V, along with picture results.

{"call":"print","params":{"printer":{"name":"88"},"options":{"bounds":null,"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":null,"interpolation":"bicubic","jobName":null,"legacy":false,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":false,"rotation":0,"scaleContent":true,"size":null,"units":"in","forceRaw":false,"encoding":null,"spool":{}},"data":[{"type":"raw","format":"image","data":"https:\/\/demo.qz.io\/assets\/img\/image_sample_bw.png","options":{"language":"ESCPOS","x":"0","y":"0","dotDensity":"double","xmlTag":"v7:Image","pageWidth":"480","pageHeight":""}}]},"signature":"","timestamp":1748400788564,"uid":"8ekcd2","position":{"x":960,"y":523},"signAlgorithm":"SHA512"}

I think that if you power cycle your printer before doing the QZ-Tray method, you should get the desired results. If you do not, please send logs:

 From the QZ Tray Icon:
Advanced, Troubleshooting, Zip Logs (To Desktop)
 
Feel free to send them directly to me (off list) or to sup...@qz.io if they contain information that you do not wish to share publicly.

Cheers,

Lite
1000003229.jpg
Reply all
Reply to author
Forward
0 new messages