Last Reviewed:


Documentation of the command line interface, callable with python-escpos.

CLI for python-escpos

usage: python-escpos [-h] [-c CONFIG]

Named Arguments

-c, --config

Alternate path to the configuration file

ESCPOS Command


Possible choices: qr, barcode, text, block_text, cut, cashdraw, image, fullimage, charcode, set, hw, control, panel_buttons, raw, demo, version, version_extended



Print a QR code

python-escpos qr [-h] --content CONTENT [--size SIZE]

Named Arguments


Text to print as a qr code


QR code size (1-16) [default:3]


Print a barcode

python-escpos barcode [-h] --code CODE --bc BC [--height HEIGHT]
                      [--width WIDTH] [--pos {BELOW,ABOVE,BOTH,OFF}]
                      [--font {A,B}] [--align_ct ALIGN_CT]
                      [--function_type {A,B}]
                      [--force_software {graphics,bitImageColumn,bitImageRaster}]

Named Arguments


Barcode data to print


Barcode format


Barcode height in px


Barcode width


Possible choices: BELOW, ABOVE, BOTH, OFF

Label position


Possible choices: A, B

Label font


Align barcode center


Possible choices: A, B

ESCPOS function type


Possible choices: graphics, bitImageColumn, bitImageRaster

Force render and print barcode as an image


Print plain text

python-escpos text [-h] --txt TXT

Named Arguments


Plain text to print


Print wrapped text

python-escpos block_text [-h] --txt TXT [--columns COLUMNS]

Named Arguments


block_text to print


Number of columns


Cut the paper

python-escpos cut [-h] [--mode {FULL,PART}]

Named Arguments


Possible choices: FULL, PART

Type of cut


Kick the cash drawer

python-escpos cashdraw [-h] [--pin {2,5}]

Named Arguments


Possible choices: 2, 5

Which PIN to kick


Print an image

python-escpos image [-h] --img_source IMG_SOURCE
                    [--impl {bitImageRaster,bitImageColumn,graphics}]
                    [--high_density_horizontal HIGH_DENSITY_HORIZONTAL]
                    [--high_density_vertical HIGH_DENSITY_VERTICAL]

Named Arguments


Path to image


Possible choices: bitImageRaster, bitImageColumn, graphics

Implementation to use


Image density (horizontal)


Image density (vertical)


Print a fullimage

python-escpos fullimage [-h] --img IMG [--max_height MAX_HEIGHT]
                        [--width WIDTH] [--histeq HISTEQ]
                        [--bandsize BANDSIZE]

Named Arguments


Path to img


Max height of image in px


Max width of image in px


Equalize the histogram


Size of bands to divide into when printing


Set character code table

python-escpos charcode [-h] --code CODE

Named Arguments


Character code


Set text properties

python-escpos set [-h] [--align {left,center,right}]
                  [--font {left,center,right}]
                  [--text_type {B,U,U2,BU,BU2,NORMAL}] [--width WIDTH]
                  [--height HEIGHT] [--density DENSITY] [--invert INVERT]
                  [--smooth SMOOTH] [--flip FLIP]

Named Arguments


Possible choices: left, center, right

Horizontal alignment


Possible choices: left, center, right

Font choice


Possible choices: B, U, U2, BU, BU2, NORMAL

Text properties


Width multiplier


Height multiplier


Print density


White on black printing


Text smoothing. Effective on >: 4x4 text


Text smoothing. Effective on >: 4x4 text


Hardware operations

python-escpos hw [-h] --hw {INIT,SELECT,RESET}

Named Arguments


Possible choices: INIT, SELECT, RESET



Control sequences

python-escpos control [-h] --ctl {LF,FF,CR,HT,VT} [--pos POS]

Named Arguments


Possible choices: LF, FF, CR, HT, VT

Control sequence


Horizontal tab position (1-4)


Controls panel buttons

python-escpos panel_buttons [-h] --enable ENABLE

Named Arguments


Feed button enabled


Raw data

python-escpos raw [-h] --msg MSG

Named Arguments


Raw data to send


Demonstrates various functions

python-escpos demo [-h] [--barcodes-a | --barcodes-b | --qr | --text]

Named Arguments


Print demo barcodes for function type A

Default: False


Print demo barcodes for function type B

Default: False


Print some demo QR codes

Default: False


Print some demo text

Default: False


Print the version information of python-escpos

python-escpos version [-h]


Print the extended version information of python-escpos (for bug reports)

python-escpos version_extended [-h]

Printer configuration is defined in the python-escpos configfile. See documentation for details.