Cash drawer NOT open after receipt print

120 views
Skip to first unread message

Paresh Patel

unread,
Dec 22, 2014, 8:28:05 AM12/22/14
to jzebra...@googlegroups.com
I use following code to do two task,  1) print receipt and then 2) open cash drawer, BUT it only print receipt,it does NOT open cash drawer :(

qz.append("\x1B\x40"); // reset printer 
qz.append("Receipt Text Samples 1\r\n"); // text on receipt
qz.append("Receipt Text Samples 2\r\n"); // text on receipt
qz.append("\r\n");
qz.append("\x1B\x40"); //reset printer 
qz.append("\x1D\x56\x41"); // cut paper 
qz.append(chr(27) + "\x70" + "\x30" + chr(25) + chr(25)); //open cash drawer code
qz.print();

When I only run code for opening cash drawer like following code, it will work and open cash drawer. Means hardware support opening cash drawer.
qz.append(chr(27) + "\x70" + "\x30" + chr(25) + chr(25)); //open cash drawer code qz.print();

Summary

Only Print Receipt it works
qz.append("Receipt Text Samples 1\r\n"); // text on receipt
qz.print();
Output: print receipt successfully

Only Open Cash Drawer it works
qz.append(chr(27) + "\x70" + "\x30" + chr(25) + chr(25)); //open cash drawer code qz.print();
Output: Open Cash Drawer successfully

For print receipt and then open cash drawer
qz.append("Receipt Text Samples 1\r\n"); // text on receipt
qz.append(chr(27) + "\x70" + "\x30" + chr(25) + chr(25)); //open cash drawer code
qz.print();
Output: print receipt successfully but cash drawer does NOT open !

Question : What to do for print receipt and then open cash drawer ? please write sample code if possible.

Paresh Patel

unread,
Dec 23, 2014, 4:03:23 AM12/23/14
to jzebra...@googlegroups.com
Anyone can help me here ? Have some one try or successful for print receipt and open cash drawer with single qz.print()  ?

Siau Pheng

unread,
Dec 23, 2014, 4:39:41 AM12/23/14
to jzebra...@googlegroups.com

Helo Paresh,

 

Can you try this :

 
qz.append("\x1B\x40\r"); // reset printer 
qz.append("Receipt Text Samples 1\r\n"); // text on receipt
qz.append("Receipt Text Samples 2\r\n"); // text on receipt
qz.append("\r\n");
qz.append("\x1D\x56\x41\r"); // cut paper 
qz.append(chr(27) + "\x70" + "\x30" + chr(25) + chr(25) + "\r"); //open cash drawer code
qz.print();

 

You can change open cash drawer code like “\x1B\x70\x30\x19\x19\r” too.

I hope this can help you.

 

Rgds,

Siau Pheng

--
--
To unsubscribe from this group, send email to jzebra-users...@googlegroups.com
 
http://code.google.com/p/jzebra

---
You received this message because you are subscribed to the Google Groups "jZebra users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jzebra-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paresh Patel

unread,
Dec 29, 2014, 1:16:17 AM12/29/14
to jzebra...@googlegroups.com
  You can change open cash drawer code like “\x1B\x70\x30\x19\x19\r” too.

 I have tried above but it did NOT worked.

Finally i thought and call separate call one for printing receipt and then for opening cash drawer and it did worked but its taking time in opening cash drawer due to separate call.

btw, Thanks Siau Pheng for the reply.

Siau Pheng

unread,
Dec 29, 2014, 11:53:18 PM12/29/14
to jzebra...@googlegroups.com

Paresh,

 

I dont know why in your code is not running, but in my code is running well.

All code print, opencashdrawer and cutting paper is working in one print() call.

 

My code like this :

 

qz.append("\x1B\x40\r"); // ESC @

qz.append("\x1B\x70\x30\x19\x19\r"); // if open drawer on begin

qz.append("\x1B\x21\x10\r\x1b\x61\x01\rSTORE NAME\r\n\x1B\x21\x01\rCITY\r\n\x1b\x61\x00\r");

qz.append("\n");

qz.append("Content ... bla bla bla\n");

qz.append("Content ... bla bla bla\n");

qz.append("Content ... bla bla bla\n");

qz.append("\n");

qz.append("\x1D\x56\x41\r"); // cut paper

//qz.append("\x1B\x70\x30\x19\x19\r"); // if open drawer on end

qz.print();

 

You can see, maybe you can try move up open cash drawer code to execute first before content. In my code, user can select choice want to open cash drawer at begin or end.

Paresh Patel

unread,
Jan 21, 2015, 9:04:31 AM1/21/15
to jzebra...@googlegroups.com
Hi Siau Pheng

On which receipt printer (name, brand) this code works fine ?
Reply all
Reply to author
Forward
0 new messages