Wednesday 15 July 2015

java - Writing correct ESC/POS commands for POS printer -


I am trying to write the appropriate ESC / POS command for the 58mm POS thermal printer. I tried to input this command as ASCII text and converted it into hex, but in both cases the printer only prints this code, not the receipt output. There is something wrong with the code, can not find examples of working code (not command).

  ESC @ Esc is a SOH ESC! NUL ESCT T25 (Select Virtual Code Table) ESC One 1.49 (Centered Text) ESC E1 Bold Text ESC E Text Line 1 Text Line 2 Text Line 3 ESC A Date / Time: 14 January 2002 15:00 ESC D & Amp; H03 ESC One ESC! 1 TM-U210B $ 20.00 and HK item 1 $ 20.00 and HK item 2 $ 10.00 and HKA and HK SC! D Total $ 30.00 LF Esc! NUL ------------------------------ LF paid $ 30.00 LF conversion $ 0.00 Thank you LF! GS MD ... DK NUL   

I should get such kind of receipt. Is there a command available for printer commands, can someone show me the proper code for it?

Are you actually sending "ESC" as three different characters?

If so, you have to send ESCI ASCII code: ASCII code 27. Similarly for NUL, SOH and other non-printable characters.

View this:

You will need to do this code because you have to send BYTE Value 27 for ESC. You can put those characters in a text file and send it to the printer, if you have a suitable text editor.

In addition to this hex value & amp; H03 will need to be sent, not the letter '& amp;', 'H', '0', '3'.


Edit: This link may be useful:

This is a cheap ESC / POS thermal printer board manual which explains the idea behind what you want to achieve.


- (e)

No comments:

Post a Comment