ESC/POS Command for printing receipt using Qz Tray 2.0

1,374 views
Skip to first unread message

kabe...@gmail.com

unread,
Apr 19, 2016, 7:13:40 PM4/19/16
to qz-print
Hi,
I am trying to create a Pos, using Qz Tray 2.0.
Can any on help me with a sample ESC receipt .

Thanks

Lite Finocchiaro

unread,
Apr 19, 2016, 9:16:03 PM4/19/16
to kabe...@gmail.com, qz-print
Here's a little bit of code that you can insert to replace the printESCP function in sample.html:

function printESCP() {
        var config = getUpdatedConfig();

        var printData = [
            '\x1B' + '\x40', // init
        '\x1B' + '\x61' + '\x31', // center align
        'Canastota, NY  13032' + '\x0A',
        '\x0A', // line break
        'www.qzindustries.com' + '\x0A', // text and line break
        '\x0A', // line break
        '\x0A', // line break
        'November 21, 2015 3:09 PM' + '\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 character symbol after numeric value
        '\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
       
        ];

        qz.print(config, printData).catch(displayError);
    }


Barcodes are a little more involved, but you can find most of the commands on-line in pdf format like this:

http://www.delfi.com/SupportDL/Epson/Manuals/TM-T88IV/Programming%20manual%20APG_1005_receipt.pdf (5.1MB)

ESCP is also known as ESC/POS, ESCP2, and other variants, but the vast majority of the commands will be the same.

Programming guides will reveal which commands have been deprecated over the years, and font sizes are usually printer-specific.

Kind regards,

Lite Finocchiaro


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

kabe...@gmail.com

unread,
Apr 20, 2016, 5:47:42 AM4/20/16
to qz-print, kabe...@gmail.com

Thanks Lite, I will give it a go.

Emmanuel Torres Velazquez

unread,
Aug 29, 2024, 9:06:10 PM8/29/24
to qz-print
Good evening, I have a question about what the function contains:
var config = getUpdatedConfig();

Lite Finocchiaro

unread,
Aug 30, 2024, 10:04:00 AM8/30/24
to Emmanuel Torres Velazquez, qz-print
getUpdatedConfig()

Generally refers to the config (printer, options) being used in sample.html

It is not common outside of our demo in my experience.

Regards,

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.

Tres Finocchiaro

unread,
Aug 31, 2024, 12:33:08 PM8/31/24
to Lite Finocchiaro, Emmanuel Torres Velazquez, qz-print
Reply all
Reply to author
Forward
0 new messages