ESC / P

from Wikipedia, the free encyclopedia

ESC / P ( E pson S tandard C ode for P RINTERS ) is one of Seiko Epson developed command language to control printers . In the era of the dot matrix printer this was used in z. Sometimes a slightly different form is also used by other manufacturers (e.g. NEC ).

ESC / P is named after the introduction of the escape sequences with the character ESC (Escape = hexadecimal 1B or decimal 27) of the ASCII character set. For example, bold type is switched on with ESC E and bold type is switched off with ESC F (this is case-sensitive, as ESC e, for example, defines a tab spacing).

Example: graphic printing with a nine-pin printer

Example graphic with 24 columns and 3 lines of 8 needles at 72 × 72 dpi

ESC * mn L n H d 1 … d k

This command prints k columns of raster graphics. The escape character has the ASCII code 27 and the asterisk has the code 42.

The byte m is the resolution in the horizontal direction, e.g. B. 5 stands for 72 dpi or 3 for 240 dpi. The resolution in the vertical direction is always 72 dpi and results from the needle spacing.

Bytes n L and n H together give the number k (low byte, high byte) of the columns to be printed.

A byte d is to be sent for each column, which codes the needles to be attached bit by bit. Bit 7 stands for the top needle. The lowest (ninth) needle is not used.

In order to print a graphic in a meaningful way, two more commands are required: carriage return (CR = 0x0d or 13) and paper advance by n / 216 inches (ESC J n). In order to print the next line directly below the printed line, enter 24 for n. If, however, the value 8 is used for n, then the feed is 8/3 of the needle distance. In this way it is possible to print with three times the vertical resolution, i.e. 216 dpi. The printout then takes three times as long.

To print the example graphic shown here, you would have to send the following data to the printer:

27 42 5 24 0 Print 24 columns at 72 dpi
0 7 15 31 62 124 120 113 241 225 224 224 224 224 225 241 113 120 124 62 31 15 7 0 Image data
13 Carriage return
27 74 24 Paper advance by 24/216 inches
27 42 5 24 0 Print 24 columns at 72 dpi
255 255 255 129 0 0 0 195 195 195 1 1 1 1 195 195 195 0 0 0 129 255 255 255 Image data
13 Carriage return
27 74 24 Paper advance by 24/216 inches
27 42 5 24 0 Print 24 columns at 72 dpi
0 224 240 248 124 62 30 142 143 199 199 199 199 199 199 143 142 30 62 124 248 240 224 0 Image data
13 Carriage return
27 74 24 Paper advance by 24/216 inches

Web links