Question

I have a Partner RP-300 receipt printer with a cash drawer connected to it for experimental purposes.It connects to the PC via LPT1.

I would like to open the cash drawer by means of a java application or a batch file.

Any ideas?

EDIT I have found out that the command to open the drawer is ESC p, hex value \x1b\x70\x00,

but how do I send that command to the printer using cmd?, I tried putting latter in a text file, then using copy \b file name lpt1, but it just prints the contents of the text file on the printer.

Was it helpful?

Solution

I have looked into the manual and the command includes two more parameters, pulse on and pulse off. It's also well explained here: How to program cash drawer to open. So the command is ESC p m t1 t2, where m is relating to connector pin, and t1, t2 are high/low times. You send only ESC p 0 (\x1b\x70\x00), while you should do eg. ESC p 0 25 250 (\x1b\x70\x00\x19\xfa)

copy /b is perfectly valid way of sending your control commands to the printer and it should work.

Just make sure that your file does include proper hex sequence using any hex editor.

Hope this helps

Edit: link to technical manual

Edit: To get command sequence encoded in file (long but easy):
1. Get Notepad++
2. Check you have Converter installed under plugins. If not, find and install it
3. Create new file in Notepad++
4. Select ANSI under encoding
5. Enter 1b700019fa

6. Select(highlight) string you entered (or select all with Ctl-A)
7. Go to plugins->Converter-> HEX --> ASCII
8. You should see garbled output (with letter p inside). Save
9. Send your file to printer.

OTHER TIPS

You should be able to use RXTX or javax.comm(depricated) to send binary commands to an LPT port.

http://rxtx.qbang.org/wiki/index.php/Using_RXTX

http://rxtx.qbang.org/wiki/index.php/Parallel_Communications

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top