Python based HTTP api for interaction with ESCPOS based printers. Basically just a web api for python-escpos
pip install -r requirements.txt
cp config.json.example config.json
- Set
config.json
parameters - Point to your printer
- Find your vendor and device IDs using
lsusb
cp printer.py.example printer.py
- Add your IDs in place of
1234
inprinter.py
- Find your vendor and device IDs using
Send a post request to /control
with a JSON serialised array of command dicts. (Check client.py
for examples)
Command name: text
data
parameters:
Parameter | Type | Usage | Optional |
---|---|---|---|
text |
str |
The text to print | Required |
size |
int |
The size of the text | Optional, defaults to 2 |
newline |
boolean |
Whether a newline should be printed at the end of the text | Optional, defaults to true |
Command name: image
data
parameters:
Parameter | Type | Usage | Optional |
---|---|---|---|
image |
str |
The image to print. Must be either a local file mapped in config.json or a url. |
Required |
Command name: qr
data
parameters:
Parameter | Type | Usage | Optional |
---|---|---|---|
text |
str |
The contents of the QR code | Required |
Command name: cut
data
parameters:
- None