CLI
- Last Reviewed:
2023-09-25
Documentation of the command line interface, callable with python-escpos
.
CLI for python-escpos
usage: python-escpos [-h] [-c CONFIG]
{qr,barcode,text,block_text,software_columns,cut,cashdraw,image,fullimage,charcode,set,hw,control,panel_buttons,raw,demo,version,version_extended}
...
Named Arguments
- -c, --config
Alternate path to the configuration file
ESCPOS Command
- parser
Possible choices: qr, barcode, text, block_text, software_columns, cut, cashdraw, image, fullimage, charcode, set, hw, control, panel_buttons, raw, demo, version, version_extended
Sub-commands
qr
Print a QR code
python-escpos qr [-h] --content CONTENT [--size SIZE]
Named Arguments
- --content
Text to print as a qr code
- --size
QR code size (1-16) [default:3]
barcode
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
- --code
Barcode data to print
- --bc
Barcode format
- --height
Barcode height in px
- --width
Barcode width
- --pos
Possible choices: BELOW, ABOVE, BOTH, OFF
Label position
- --font
Possible choices: A, B
Label font
- --align_ct
Align barcode center
- --function_type
Possible choices: A, B
ESCPOS function type
- --force_software
Possible choices: graphics, bitImageColumn, bitImageRaster
Force render and print barcode as an image
text
Print plain text
python-escpos text [-h] --txt TXT
Named Arguments
- --txt
Plain text to print
block_text
Print wrapped text
python-escpos block_text [-h] --txt TXT [--columns COLUMNS]
Named Arguments
- --txt
block_text to print
- --columns
Number of columns
software_columns
Print a list of texts arranged into columns
python-escpos software_columns [-h] --text_list TEXT_LIST [TEXT_LIST ...]
--widths WIDTHS [WIDTHS ...] --align ALIGN
[ALIGN ...]
Named Arguments
- --text_list
list of texts to print
- --widths
list of column widths
- --align
list of column alignments
cut
Cut the paper
python-escpos cut [-h] [--mode {FULL,PART}]
Named Arguments
- --mode
Possible choices: FULL, PART
Type of cut
cashdraw
Kick the cash drawer
python-escpos cashdraw [-h] [--pin {2,5}]
Named Arguments
- --pin
Possible choices: 2, 5
Which PIN to kick
image
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
- --img_source
Path to image
- --impl
Possible choices: bitImageRaster, bitImageColumn, graphics
Implementation to use
- --high_density_horizontal
Image density (horizontal)
- --high_density_vertical
Image density (vertical)
fullimage
Print a fullimage
python-escpos fullimage [-h] --img IMG [--max_height MAX_HEIGHT]
[--width WIDTH] [--histeq HISTEQ]
[--bandsize BANDSIZE]
Named Arguments
- --img
Path to img
- --max_height
Max height of image in px
- --width
Max width of image in px
- --histeq
Equalize the histogram
- --bandsize
Size of bands to divide into when printing
charcode
Set character code table
python-escpos charcode [-h] --code CODE
Named Arguments
- --code
Character code
set
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
- --align
Possible choices: left, center, right
Horizontal alignment
- --font
Possible choices: left, center, right
Font choice
- --text_type
Possible choices: B, U, U2, BU, BU2, NORMAL
Text properties
- --width
Width multiplier
- --height
Height multiplier
- --density
Print density
- --invert
White on black printing
- --smooth
Text smoothing. Effective on >: 4x4 text
- --flip
Text smoothing. Effective on >: 4x4 text
hw
Hardware operations
python-escpos hw [-h] --hw {INIT,SELECT,RESET}
Named Arguments
- --hw
Possible choices: INIT, SELECT, RESET
Operation
control
Control sequences
python-escpos control [-h] --ctl {LF,FF,CR,HT,VT} [--pos POS]
Named Arguments
- --ctl
Possible choices: LF, FF, CR, HT, VT
Control sequence
- --pos
Horizontal tab position (1-4)
raw
Raw data
python-escpos raw [-h] --msg MSG
Named Arguments
- --msg
Raw data to send
demo
Demonstrates various functions
python-escpos demo [-h] [--barcodes-a | --barcodes-b | --qr | --text]
Named Arguments
- --barcodes-a
Print demo barcodes for function type A
Default:
False
- --barcodes-b
Print demo barcodes for function type B
Default:
False
- --qr
Print some demo QR codes
Default:
False
- --text
Print some demo text
Default:
False
version
Print the version information of python-escpos
python-escpos version [-h]
version_extended
Print the extended version information of python-escpos (for bug reports)
python-escpos version_extended [-h]
Printer configuration is defined in the python-escpos configuration file. See documentation for details.