Skip to content

lilkimo/escpos-server

Repository files navigation

PYTHON ESC/POS SERVER

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.

HOW TO USE

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

ADDITIONAL CONSIDERATIONS

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).

HOW TO PRINT

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.

ENDPOINTS

There are 2 endpoints:

/print/network?ip=IP&port=PORT

Works for printers connected to your LAN network via Ethernet or WiFi.

/print/driver?shareName=SHARENAME

Works for printers added to Windows, typically via USB or Bluetooth (see Additional Considerations).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors