Pregunta

I want execute commands of one printer epson TM-T88III.

to be more specific:

and my doubts are: How I do this? How I set those commands to printer by way of c#? What am I choose? Hexodecimal? Binary? Decimal? I'm confused!

Thank you

¿Fue útil?

Solución

In C# you can communicate with the printer using (for example) the serial port classes (if that printer has a serial interface) or standard I/O classes (for example if it has a parallel interface you'll address LPTx: device).

Printer is a character device then you'll always send bytes (one character = 1 byte because that printer uses 8 bit ASCII). It'll interpret that bytes as ASCII codes (according to current code page) to print characters. To send command to them you have to use their language, because some ASCII characters are special (everything with code less than 32) it'll interpret some sequences as commands.

Don't confuse the way they write that commands in the documentation (decimal, hex) with what you send: character A has ASCII code 65 (in decimal and 41 in hexadecimal) and it's always a byte value with its ASCII code.

For EPSON printers you use the ESCAPE character (ASCII code 27) to start a command sequence, bytes that follows will be interpreted as commands and they won't be printed as text (let's imagine you send this sequence: 27 65, it won't print the A character but it'll interpret the command number 65 - if it exists). Let's see this example from that documentation:

ASCII   ESC   M   n
Hex     1B    4D  n
Decimal 27    77  n

You just have three ways to represent that sequence (first as ASCII and names, second with hexadecimal values and third with decimal values). It's for you, to the printer you will always send three bytes (again bytes not a string with their decimal representation).

Symbol for isn't a known character for that printer (otherwise you may simply set the code page and live happy). What you can do is to discard one of the characters you have but you don't use and to replace it with a custom character using the ESC & command (page 113 of the documentation for an example), you'll send a bitmap (=a matrix of 1 and 0) that the printer will print for that character.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top