2.1 Raw Printing ESC/POS Error

504 views
Skip to first unread message

vian.d...@gmail.com

unread,
Jul 25, 2019, 12:38:46 AM7/25/19
to qz-print
When i'm trying to test Raw Printing with ESC/POS language with qz example, i got this error when i check on console.log browser.
The code i used, i got it from here 2.1-Raw-Printing escpos

var config = qz.configs.create("LX-300");
       var data = [
           { type: 'raw', format: 'image', flavor: 'file', data: 'assets/img/image_sample_bw.png', options: { language: "escp", dotDensity: 'double' } },
           '\x1B' + '\x40',          // init
           '\x1B' + '\x61' + '\x31', // center align
           'Beverly Hills, CA  90210' + '\x0A',
           '\x0A',                   // line break
           'www.qz.io' + '\x0A',     // text and line break
           '\x0A',                   // line break
           '\x0A',                   // line break
           'May 18, 2016 10:30 AM' + '\x0A',
           '\x0A',                   // line break
           '\x0A',                   // line break    
           '\x0A',
           'Transaction # 123456 Register: 3' + '\x0A',
           '\x0A',
           '\x0A',
           '\x0A',
           '\x1B' + '\x61' + '\x30', // left align
           'Baklava (Qty 4)       9.00' + '\x1B' + '\x74' + '\x13' + '\xAA', //print special char symbol after numeric
           '\x0A',
           'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + '\x0A',      
            '\x1B' + '\x45' + '\x0D', // bold on
           'Here\'s some bold text!',
           '\x1B' + '\x45' + '\x0A', // bold off
           '\x0A' + '\x0A',
           '\x1B' + '\x61' + '\x32', // right align
           '\x1B' + '\x21' + '\x30', // em mode on
           'DRINK ME',
           '\x1B' + '\x21' + '\x0A' + '\x1B' + '\x45' + '\x0A', // em mode off
           '\x0A' + '\x0A',
           '\x1B' + '\x61' + '\x30', // left align
           '------------------------------------------' + '\x0A',
           '\x1B' + '\x4D' + '\x31', // small text
           'EAT ME' + '\x0A',
           '\x1B' + '\x4D' + '\x30', // normal text
           '------------------------------------------' + '\x0A',
           'normal text',
           '\x1B' + '\x61' + '\x30', // left align
           '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A',
           '\x1B' + '\x69',          // cut paper (old syntax)
           // '\x1D' + '\x56'  + '\x00' // full cut (new syntax)
           // '\x1D' + '\x56'  + '\x30' // full cut (new syntax)
           // '\x1D' + '\x56'  + '\x01' // partial cut (new syntax)
           // '\x1D' + '\x56'  + '\x31' // partial cut (new syntax)
           '\x10' + '\x14' + '\x01' + '\x00' + '\x05',  // Generate Pulse to kick-out cash drawer**
                                                           // **for legacy drawer cable CD-005A.  Research before using.
           ];      
qz.print(config, data).catch(function(e) { console.error(e); });


Screenshot_2019-07-25_11-25-56.png

Tres Finocchiaro

unread,
Jul 25, 2019, 12:51:33 AM7/25/19
to vian.d...@gmail.com, qz-print
I tested your code and I cannot reproduce.  What version of QZ Tray are you using?  I ask because that's a 2.1 tutorial.


That said, it still should work with 2.0. The only difference is the addition of the "flavor" to the data object. 

I'm stumped by your error, I've never seen it before.  Any technical details or more background information to reproduce is greatly apprecaited.

JSONArray[1] is not a JSONObject

--
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 on the web visit https://groups.google.com/d/msgid/qz-print/942a2ad2-2d89-4e92-b534-dadde31a02e0%40googlegroups.com.

Lite Finocchiaro

unread,
Jul 25, 2019, 12:55:40 AM7/25/19
to vian.d...@gmail.com, qz-print
The LX-300 uses a slightly different version of this language, named ESCP2 in multiple programming guides.

Please use an ESCP2 programming guide to write your code, as our ESC/POS example was written for use with Epson thermal receipt printers, like the TM-T88V 



Regards,

Lite
VP, QZ Industries



--

vian.d...@gmail.com

unread,
Jul 25, 2019, 1:01:24 AM7/25/19
to qz-print
at first i'm gonna reinstall the QZ first, by the way my version of QZ is 2.1.0 . If that's not working, may be because of the language version for LX-300 is diffrent. Thanks for the info guys,

Tres Finocchiaro

unread,
Jul 25, 2019, 1:20:50 AM7/25/19
to vian.d...@gmail.com, qz-print
Just to clarify.. The language is very important for correct output, but won't cause the original error.

--
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.

vian.d...@gmail.com

unread,
Jul 25, 2019, 1:50:32 AM7/25/19
to qz-print
When i remove this line
{ type: 'raw', format: 'image', flavor: 'file', data: 'assets/img/image_sample_bw.png', options: { language: "escp", dotDensity: 'double' } }
the code works, and if i'm trying to print the image alone without the ESC language its working too. But When combine the escp and the image is not working. I'm still using my 2.1.0 Qz
To unsubscribe from this group and stop receiving emails from it, send an email to qz-p...@googlegroups.com.

Tres Finocchiaro

unread,
Jul 25, 2019, 1:56:52 AM7/25/19
to vian.d...@gmail.com, qz-print
Might be a duplicate of https://github.com/qzind/tray/issues/462.

Can you snag the latest qz-tray.js from GitHub?


To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qz-print/4f77e86a-1612-459d-8e23-6de6c0d2de78%40googlegroups.com.

vian.d...@gmail.com

unread,
Jul 25, 2019, 2:05:49 AM7/25/19
to qz-print
Still the same problem,

Tres Finocchiaro

unread,
Jul 25, 2019, 11:15:35 AM7/25/19
to vian.d...@gmail.com, qz-print
Using the latest 2.1 version, copying and pasting the code into sample.html (changed "data" to "printData"), the example in this email works on my machine, the error doesn't happen.

This leads me to believe that the error is caused by a bug that's been fixed since you installed QZ Tray.

... but if you're using ESCP/2, you shouldn't need 2.1 at all.  You should be able to get up and running with 2.0.

If you cannot provide the steps to reproduce in another environment, we can't dive into the error.

To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qz-print/e9bf0d41-72e3-410c-82ce-231d2118408f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages