Search code examples
pythonpoint-of-saleepsonescpos

Printing to a POS Thermal Printer using Python


Good day,

I'm working on a simple Python project and I need to print a receipt to an Epson TM-T82X thermal printer. I have checked the python-escpos library and it has good documentation.

Example is this one:

from escpos.printer import Usb

""" Seiko Epson Corp. Receipt Printer (EPSON TM-T88III) """
p = Usb(0x04b8, 0x0202, 0, profile="TM-T88III")
p.text("Hello World\n")
p.image("logo.gif")
p.barcode('1324354657687', 'EAN13', 64, 2, '', '')
p.cut()

My problem is where to get the two Usb parameters '0x04b8' and '0x0202'. I know that they are device and manufacturer IDs. Checking the documentation further, it said that the IDs can be acquired by checking the printer's Device Instance Path or Hardware ID. I've checked that as well and it gives something like this:

SWD\PRINTENUM\{67FDD9C0-3ADC-4191-9B80-1711BCA4B9DF}

I am running on Windows 10 and Windows 11. Please help. Thank you.


Solution

  • On Windows, you can find the vendor and device IDs using the Device Manager:

    1. Press Win + X, then choose Device Manager.
    2. Locate and expand the "Universal Serial Bus controllers" section.
    3. Right-click on the device (your printer) and choose Properties.
    4. Go to the "Details" tab and select "Hardware Ids" from the drop-down list.

    Here, you'll find the vendor ID (VID) and product ID (PID), formatted like VID_XXXX&PID_XXXX. These are the values you'll use in your code.