Barcode printing on receipt printer using the ESC/POS Commands
Written by kksou   
Wednesday, 16 April 2008

This article shows you the ESC/POS commands for the printing of barcodes on standard Epson receipt printer such as the Epson TM-T88III.

How to interface to receipt printer in a point of sale system?

The ESC/POS commands are a set of proprietary POS printer command system developed by EPSON.

If you have a different printer, please refer to the corresponding codes in your printer manual. But Epson is pretty much the industry standard for receipt printer and most receipt printers support these ESC/POS commands. You can just try the commands below. Most likely it will work on your receipt printer.

GS f

Note: GS below refers to hexadecimal number "1D".

Description: Select barcode font
Format: GS f n
n=0
Font A
n=1
Font B

Note: this assumes that your receipt printer comes with 2 built-in barcode fonts.

PHP sample code:
fwrite($handle, chr(hexdec('1D')).'f'.chr(0));

GS H

Description: Sets the position of where you want to print the barcode text
Format: GS H n
n=0
Don't print any text
n=1
Above the barcode
n=2
Below the barcode
n=3 Both above and below the barcode
PHP sample code:
fwrite($handle, chr(hexdec('1D')).'H'.chr(2));

GS w

Description: Sets the width of the barcode
Format: GS w n
n=1
n=2
n=3
PHP sample code:
fwrite($handle, chr(hexdec('1D')).'w'.chr(2));

GS h

GS k

Work in progress ...

Resources on barcodes

Here are some useful links on barcodes:



User reviews

There are no user reviews yet.

Note: You have to be a registered member to leave a comment. Free registration here.

 
< Prev   Next >

Copyright © 2006-2008. kksou.com. All Rights Reserved