Python Library for pos printer
Project description
Description
Python ESC/POS is a library which lets the user have access to all those printers handled by ESC/POS commands, as defined by Epson, from a Python application.
The library tries to implement the functions provided by the ESC/POS-commandset and supports sending text, images, barcodes and qr-codes to the printer.
Text can be aligned/justified and fonts can be changed by size, type and weight.
Also, this module handles some hardware functionalities like cutting paper, control characters, printer reset and similar functions.
Since supported commands differ from printer to printer the software tries to automatically apply the right settings for the printer that you set. These settings are handled by escpos-printer-db which is also used in escpos-php.
Dependencies
This library makes use of:
pyusb for USB-printers
Pillow for image printing
qrcode for the generation of QR-codes
pyserial for serial printers
python-barcode for the generation of barcodes
Documentation and Usage
The basic usage is:
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()
Another example based on the Network printer class:
from escpos.printer import Network
kitchen = Network("192.168.1.100") #Printer IP Address
kitchen.text("Hello World\n")
kitchen.barcode('1324354657687', 'EAN13', 64, 2, '', '')
kitchen.cut()
Another example based on the Serial printer class:
from escpos.printer import Serial
""" 9600 Baud, 8N1, Flow Control Enabled """
p = Serial(devfile='/dev/tty.usbserial',
baudrate=9600,
bytesize=8,
parity='N',
stopbits=1,
timeout=1.00,
dsrdtr=True)
p.text("Hello World\n")
p.qr("You can readme from your smartphone")
p.cut()
The full project-documentation is available on Read the Docs.
Contributing
This project is open for any contribution! Please see CONTRIBUTING.rst for more information.
Disclaimer
None of the vendors cited in this project agree or endorse any of the patterns or implementations. Its names are used only to maintain context.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file psk-escpos-1.0.8.tar.gz
.
File metadata
- Download URL: psk-escpos-1.0.8.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28a1a071ba2ad089bab321ddf29ac4f98c5241c8b43276ce9f58e26f56d98c9b |
|
MD5 | 9803350d5d8a0943dd0fb7593aab66e0 |
|
BLAKE2b-256 | cfd23a59820996ffde445a8cb580867940c45f22e602453343130483abf44b79 |
File details
Details for the file psk_escpos-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: psk_escpos-1.0.8-py3-none-any.whl
- Upload date:
- Size: 67.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e17ff624d5740c0466963ddb3078bf79ed6842bd0f4852e9b8ba779fe0623b77 |
|
MD5 | 9b471975e2732e08f7db0b06a867c226 |
|
BLAKE2b-256 | a8b86d3f184e19c3994873d98e57fb13b05720e7e1763d46a655f2c078606acf |