Android Question Epson (ESC/POS) commands - Printer

Nikan99

Member
Hello,
I have an usb printer (i don't know it's model neither it's codepage, i can not print it and i don't have any documentation) and i have made the connection with my app. I can send POS/ESC commands and print my result but if i try to send a POS/ESC command using an "n" 2 digit number, the printer receive the first digit as the n and the second digit will be added to my string.
I have an example and its result.

For i=0 To 2
Dim output As String =ESC & 3 & 12 & "test" & newline
Dim buf() As Byte = output.GetBytes("UTF8")
req.Queue(buf,buf.Length)
Next

The result we want to print is:
test
\
12 lines distance
/
test


BUT it will print me:

2test
} 1 line distance
2test

Do you have anything in mind?
 

agraham

Expert
Licensed User
Longtime User
n needs to be s single byte in the range 0 to 255. Your "12" is output as two characters. Try
Dim output As String =ESC & 3 & Chr(12) & "test" & newline

Dim buf() As Byte = output.GetBytes("UTF8")

The codepage is normally "IBM437" for ESC/POS printers, though "UTF8" will work if you only want to print characters for the lower ASCII character range of 0 to 127.

Also check this out. It is set up for Bluetooth but you only need to change WriteBytes and WriteString2 in the EscPosPrinter module to write to your USB
 
Upvote 0
Top