Open Cash Drawer Without Printing Using Star TSP100III Printer

1,103 views
Skip to first unread message

cha...@instantestore.com

unread,
Sep 5, 2019, 5:49:51 AM9/5/19
to qz-print
Hi, there. I'm trying to open the cash drawer using QZTray without printing anything. I'm using a cash drawer that's attached to my Star TSP100III printer via an RJ45 cable.

I'm able to configure the cash drawer to open using the normal Windows configuration as seen below and using pixel printing.

star_printer_settings.png



However, now I'm trying to get the cash drawer to open WITHOUT printing anything. I've tried using the below function but nothing seems to be happening.

function openDrawerQZTray(printer) {
    var config = qz.configs.create(printer);
    var data = [{ type: 'raw', format: 'plain', data: '\x10' + '\x14' + '\x01' + '\x00' + '\x05', options: { language: "ESCPOS" } }];
    qz.print(config, data).catch(displayError);
}

If I'm not mistaken, the Star printer comes default in "Star Line Mode". Since I'm normally using pixel-based printing with QZTray, I haven't had to mess with the mode.

Is it possible to open the cash drawer while the printer is in Star Line Mode? If so, how do I do it?

Or must I change it to ESC/POS mode? If so, how would I change it to ESC/POS mode?

I'm using QZTray 2.0.5.

Thank you very much for your help.

Charles Tang

cha...@instantestore.com

unread,
Sep 6, 2019, 5:39:57 AM9/6/19
to qz-print
Managed to figure this out! It was a combination of things that we weren't doing correctly.

The script should be:

function openDrawerQZTray(printer) {
    var config = qz.configs.create(printer);
    var data = [{ type: 'raw', format: 'hex', data: '1B7007F7F0d0a'}];
    qz.print(config, data).catch(displayError);
}

Note that the "format" is "hex" and we can pass in the hex code directly. Also, there's a "0d0a" at the end. I guess that's to denote the end of the print job.

Charles Tang

Tres Finocchiaro

unread,
Sep 6, 2019, 9:51:30 AM9/6/19
to cha...@instantestore.com, qz-print
var data = [{ type: 'raw', format: 'hex', data: '1B7007F7F0d0a'}];

I hope you don't mind, I'm going to write this in (what I believe to be) proper two-character format.

var data = [{ type: 'raw', format: 'hex', data: 'x1Bx70x07xF7xF0xD0x0A'}];

You have an uneven number of hex characters, so I've adjusted the last byte to read 0A (this is a newline character).

I've compared this character sequence against the most comprehensive kick-out list (made by Dale Harris) here
http://keyhut.com/popopen4.htm and yours doesn't exist.  This generally means one of two things... 
  1. You figured out something Dale didn't
    --- OR ---
  2. ... or your codes are incorrect but they work anyway.
I'd strongly recommend trying other combinations from Dale's list and seeing if they work.  If not, you should share your codes with him, he'd be very happy. 

... and this byte sequence (translated to decimal) below is what I believe you're sending.  It doesn't match any he has.  Note, each hex byte needs to to be translated to decimal (and vice-versa if testing his).

x1B = 27
x70 = 112
x07 = 7
xF7 = 247
xF0 = 240
xD0 = 208
x0A = 10

--
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/da5f5c59-91df-469e-9edf-75ad817b26b9%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages