Skip to main content

Python library to manipulate ESC/POS Printers

Project description

Documentation Status

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-command-set 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:

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('4006381333931', '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('4006381333931', '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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-escpos-3.0.tar.gz (197.7 kB view details)

Uploaded Source

Built Distribution

python_escpos-3.0-py3-none-any.whl (68.9 kB view details)

Uploaded Python 3

File details

Details for the file python-escpos-3.0.tar.gz.

File metadata

  • Download URL: python-escpos-3.0.tar.gz
  • Upload date:
  • Size: 197.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for python-escpos-3.0.tar.gz
Algorithm Hash digest
SHA256 b06bc44a460fc7c209219c491f5171f3b6f0b93b37617f08f65309ac5b252fac
MD5 14e65962cbe7e86700dd3c22d7f3669a
BLAKE2b-256 a4e722b765d20e45ca8fbccff73c4f883b479751f6bc6daab3a6665fdb95b1bd

See more details on using hashes here.

File details

Details for the file python_escpos-3.0-py3-none-any.whl.

File metadata

  • Download URL: python_escpos-3.0-py3-none-any.whl
  • Upload date:
  • Size: 68.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for python_escpos-3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9eec4a2c290a3b215ad8501f17c614a42064df1677396bbf355275f96a3d79a
MD5 7acccd57c250c09747e7004ff8bcb337
BLAKE2b-256 5ce78ddde6bbfa3889e426bf6f6f6c786f6ce80de043bdf1eb65b386c76bf05a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page