I'm trying to make a cash drawer kick open. The command that needs to be sent to the drawer, by way of the receipt printer, is "chr(27).chr(112).chr(0).chr(100).chr(250)". Is there a way to send this command through javascript or other web based language. I want the cash drawer to only open only during certain receipt prints.
For background first see my answer here How to print a receipt through Receipt Printer from Web Page(.aspx)?
The ESC/P cash draw code you have is correct as per: http://www.beaglehardware.com/howtoprogramcashdrawer.html
The problem is discussed here: https://code.google.com/p/jzebra/issues/detail?id=134
POS world says the kickout code is: 1B 70 00 40 F0, however the "00" won't work (it's a limitation of the web browser)
Download jZebra - it's now evolved into the qz-print library, put the jar file in the project directory and the first method in this jzebra mail thread works for me:
<form id="form1" runat="server">
<div>
<input type=button onClick="openCashDrawer()" value="Open Cash Drawer">
<applet name="jzebra" code="jzebra.PrintApplet.class" archive="./jar/jzebra.jar" width="100" height="100">
<param name="printer" value="zebra">
</applet>
<script>
function chr(i) {
return String.fromCharCode(i);
}
function openCashDrawer() {
document.jzebra.append(chr(27) + "\x70" + "\x30" + chr(25) + chr(25) + "\r");
document.jzebra.print();
}
</script>
The base64 and appendFile methods discussed in that thread didn't work for me but apparently appendFile(file with raw ESC/P Commands)
and append64(base64)
do workaround the "Chr(0)" limitation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With