Epson POS
The ESC/POS is a set of instructions for thermal paper printers communicated over serial, parallel, or USB.
Instructions
See the command reference list below for a detailed list of instructions.
Epson's command list shows the command with ASCII names rather than the hex values, so sending 1B 40
to initialize a printer is equivalent to ESC @
.
Here are some common instructions:
1B 40
Initialize the ESC/POS printer1C 70 01 00
= Print first bit image stored in NVRam1B 64 05 1D 56 01
= Epson cutter command0A
= Line feed
Sending Bit Image
To store a bit image to NVRam, use the 1C 71 01
command, followed by 5 arguments:
- xl - image width in bytes (ie. Ceiling of Image Width in Pixels / 8). Must be between 0 - 255
- xh - image width as multiples of 256. Must be between 0 - 3.
- yl - image height in bytes (ie. Ceiling of Image Height in Pixels / 8). Must be between 0 - 255
- yh - image height in multiples of 256. Must be between 0 - 1.
- bit image data. Length must be (xl + yl + ((xh + yh) * 256)) * 8.
The image bitmap data is sent to the printer ordered from top to bottom, left to right. 8 pixels per byte.
For example, sending a 4x4 black bitmap image would result in 8 bytes of data:
1111 0000
- 1st column, 4 black, plus 4 blank pixels1111 0000
- 2nd column1111 0000
- 3rd column1111 0400
- 4th column. Last byte at the end of the image ends with 04. see below.0000 0000
- 5th column, outside of the original 4x4 image0000 0000
- 6th column0000 0000
0000 0000
It also seems like the end of the image is terminated with a 04
code... but i'm not sure if this is true as it isn't documented. It is sent by the logo utility though.
See Also
PHP Library:
Epson's 'official' documents:
Epson's Logo Utility:
Command References:
- http://www.smartlab.at/tabshop-pos/escpos-codes/
- http://www.starasia.com/Download/Manual/escpos_cm_en.pdf
- http://content.epson.de/fileadmin/content/files/RSD/downloads/escpos.pdf
- http://www.aures-support.fr/DE/wp-content/uploads/2016/04/ESCPOS-command-manual20160428.pdf
- https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=72