I try to make a static simple page using HTML, JS, QZ-Tray that can print a mock data into LQ-310 printer.
I've been follow how to sign in JS from QZ-Tray wiki. However, I still have pop up message like below:
I've changed the flow from server side to client side to sign and remove this pop up, but it has no effect
NOTE:
The project works just fine on my computer. These are the steps I ran:
git clone https://github.com/Rusydy/print-qz-static
qz-cert.js
and saving it as certificate.crt
.certificate.crt
file into the Site Manager dialog.index.html
, click "Test printer"I did receive a JavaScript error, however it did not result in a pop-up warning dialog. The document prints first time, no pop-ups.
qz-cert.js:27 Uncaught TypeError: Cannot read properties of undefined (reading 'then')
at qz-cert.js:27:3
This error message is fairly benign, but it's because you're using a .then(...)
on your setCertificatePromise()
call here. The function call setCertificatePromise()
does not return a promise, so any error detection must be internal (e.g. manually throw an exception raised by fetch()
or $.ajax()
, etc when loading this certificate from a URL). Since you're loading the certificate from a string value, no exception handling is needed, but regardless, .then()
must be removed from this file to remove the error.
In regards to the pop-up you are receiving, this is a sign that the certificate you've created hasn't been installed into QZ Tray. You may drag-and drop it into the Site Manager dialog to install it to your system (or manually by copying it to <appdir>\override.crt
and restarting QZ Tray).