Unable to send data to printer

241 views
Skip to first unread message

Wai-Sun Chia

unread,
May 6, 2018, 11:57:09 AM5/6/18
to qz-print
Hello,
Newbie here. I followed the exact exercise in the tutorial, but I got an error..
I got the first console.log, but not the second, as it was errored out. 
Please help!

       qz.websocket.connect().then(function() { 
            return qz.printers.find("POS-Printer").then(function(found) {
                console.log("Printer: "+JSON.stringify(found));
            });

        }).then(function(printer) {
            var config = qz.configs.create(printer);
            var data = ['The quick brown fox jumped over the lazy dog'];
            return qz.print(config, data).then(function(data) {
                console.log('Sent to printer:'+JSON.stringify(data));
            });

        }).catch(function(e) {
            console.error(e);
        });


_qz.websocket.connection.onmessage @ qz-tray.js:306
opossum:1617 Error: A printer must be specified before printing
    at WebSocket._qz.websocket.connection.onmessage (qz-tray.js:304)

Tres Finocchiaro

unread,
May 6, 2018, 12:38:34 PM5/6/18
to Wai-Sun Chia, qz-print
 return qz.printers.find("POS-Printer").then(function(found) {
                console.log("Printer: "+JSON.stringify(found));
            });

Your error suggests that a printer named "POS-Printer" does not exist on your computer.

If this is not true, please try to close and re-open QZ Tray.  Sometimes newly added printers aren't registered by Java, especially when using the CUPS-backend.

If the printer was added and QZ Tray was restarted and it still cannot be found, you may need to restart the print spooler, which varies by platform, but it's generally "spooler" service in Windows or the CUPS service in Unix.

-Tres 



--
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.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages