I have been trying to print to multiple printers with QZ tray using the examples provided here https://qz.io/wiki/2.0-Raw-Printing#promise-loop
but I am getting an error saying TypeError: Cannot read property 'sendData' of null
I have rsvp-3.1.0.min.js
, sha-256.min.js
and qz-tray.js
included.
I use the exact same code provided by the example but obviously changed the printers names to the ones I have installed.
Everything works fine if I try to print to each printer separately (the default way of doing it)
Any idea of what could be wrong or if I am missing a library or something?
Thank you
This is the full error message on Safari:
TypeError: Cannot read property 'sendData' of null
at qz-tray.js:323
at lib$rsvp$$internal$$initializePromise (rsvp-3.1.0.min.js:10)
at new lib$rsvp$promise$$Promise (rsvp-3.1.0.min.js:10)
at Object.promise (qz-tray.js:456)
at Object.dataPromise (qz-tray.js:314)
at Object.find (qz-tray.js:788)
at link (test.html:388)
at lib$rsvp$$internal$$tryCatch (rsvp-3.1.0.min.js:10)
at lib$rsvp$$internal$$invokeCallback (rsvp-3.1.0.min.js:10)
at rsvp-3.1.0.min.js:10
So I found the problem and it was my own mistake, I forgot to initiate QZ tray, the script works perfectly, tested sending a Pixel job to a laser printer and a Raw job to a thermal printer.
EDIT: Solution