HTTP API built on top of python-escpos and FastAPI designed to run on Windows. No extra hardware required. No extra software required. No Zadig, WinUSB, libudev, libusb or pywin32 required.
escpos-server> pip install fastapi[standard]>=0.115.5
escpos-server> pip install python-escpos[all]>=3.1
escpos-server> fastapi dev --port 9130
Then you can access it via the following URL: http://localhost:9130/docs
To use the USB and Bluetooth interfaces the printer must be added to Windows. This typically happens automatically after plugging your device or installing its drivers. This article might be helpful.
Next you have to share your printer and give it a Share name.
The Serial Port interface is not supported (unless you manage to add the printer to Windows).
Commands must be sent via a POST request to the API (see endpoints). The body must have the following structure:
[
{
"command": "command",
"args": [],
"kwargs": {}
},
...
]
* Supported commands: 'image', 'qr', 'barcode', 'text', 'textln', 'ln', 'block_text', 'cut', 'buzzer'
For more information about the commands/methods and their arguments, see python-escpos docs.
There are 2 endpoints:
Works for printers connected to your LAN network via Ethernet or WiFi.
Works for printers added to Windows, typically via USB or Bluetooth (see Additional Considerations).