TODO Merge this page with the API-description. (Make the API-description more pretty and then replace this with the API-description.)
Escpos inherits its methods to the printers. the following methods are defined:
Prints an image. Its adjust the size in order to print it.
image_name.extis the complete file name and location of any image type (jpg, gif, png, bmp)
Prints a QR code. The size has been adjusted to Version 4, so it can be enough small to be printed but also enough big to be read by a smart phone.
textAny text that needs to be QR encoded. It could be a slogan, salutation, url, etc.
barcode(“code”, “barcode_type”, width, height, “position”, “font”)¶
Prints a barcode.
codeis an alphanumeric code to be printed as bar code
barcode_typemust be one of the following type of codes for function type A:
And for function type B:
- Any type above
- GS1 DataBar Omnidirectional
- GS1 DataBar Truncated
- GS1 DataBar Limited
- GS1 DataBar Expanded
widthis a numeric value in the range between (1,255) Default: 64
heightis a numeric value in the range between (2,6) Default: 3
positionis where to place the code around the bars, could be one of the following values:
- OFF > Default: BELOW
fontis one of the 2 type of fonts, values could be:
- B > Default: A
fuction_typechooses between ESCPOS function type A or B. A is default, B has more barcode options. Choose which one based upon your printer support and require barcode.
- B > Default A
Prints raw text. Raises
set(“align”, “font”, “type”, width, height, invert, smooth, flip)¶
Set text properties.
align set horizontal position for text, the possible values are:
- RIGHT > > Default: left
fonttype could be
B. Default: A
typetype could be
normal. Default: normal
widthis a numeric value, 1 is for regular size, and 2 is twice the standard size. Default: 1
heightis a numeric value, 1 is for regular size and 2 is twice the standard size. Default: 1
invertis a boolean value, True enables white on black printing. Default: False
smoothis a boolean value, True enables text smoothing. Default: False
flipis a boolean value, True enables upside-down text. Default: False
mode set a full or partial cut. Default: full
Partial cut is not implemented in all printers.
Sends a pulse to the cash drawer in the specified pin.
pinis a numeric value which defines the pin to be used to send the pulse, it could be 2 or 5. Raises
operationis any of the following options:
Carrier feed and tabs.
align is a string which takes any of the following values:
- LF for Line Feed
- FF for Form Feed
- CR for Carriage Return
- HT for Horizontal Tab
- VT for Vertical Tab