Javascript: Is there a way to send cash wallet code?

I'm trying to open a cash drawer. The command to be sent to the box using the receipt printer is "chr (27) .chr (112) .chr (0) .chr (100) .chr (250)". Is there any way to send this command through javascript or another web language. I want the cash drawer to open only during certain printouts of receipts.

+5
source share
1 answer

To get started, check out my answer here. How do I print a receipt using a receipt printer from a web page (.aspx)?

You have the correct ESC / P code for receiving cash in accordance with: http://www.beaglehardware.com/howtoprogramcashdrawer.html

The issue 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 a limitation of the web browser)

Download jZebra - now it has turned into a qz-print library, put the jar file in the project directory, and the first method in this jzebra mail branch 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 this thread did not help me, but apparently appendFile(file with raw ESC/P Commands) and append64(base64) bypass the "Chr (0)" restriction.

+5
source

Source: https://habr.com/ru/post/1314394/


All Articles