All Projects → mosquito → python-escpos

mosquito / python-escpos

Licence: other
Fork of https://code.google.com/p/python-escpos/

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python-escpos

Escpos Php
PHP library for printing to ESC/POS-compatible thermal and impact printers
Stars: ✭ 1,851 (+6755.56%)
Mutual labels:  printer, escpos
escpos-xml
JavaScript library that implements the thermal printer ESC / POS protocol and provides an XML interface for preparing templates for printing.
Stars: ✭ 37 (+37.04%)
Mutual labels:  printer, escpos
ESCPOS
A ESC/POS Printer Commands Helper
Stars: ✭ 26 (-3.7%)
Mutual labels:  printer, escpos
Vip.Printer
Biblioteca para realizar impressões (impressora não fiscal) utilizando comandos Esc/Bema, Esc/Daruma e Esc/Pos 🚀
Stars: ✭ 48 (+77.78%)
Mutual labels:  printer, escpos
quickprinter
[Quick Printer] Created for the purpose of serving as a channel among other applications that require printing data on receipt printers using ESC / POS commands.
Stars: ✭ 99 (+266.67%)
Mutual labels:  printer, escpos
escpos-coffee-samples
anastaciocintra.github.io/escpos-coffee
Stars: ✭ 29 (+7.41%)
Mutual labels:  escpos
StarPRNT-SDK-iOS-Swift
StarPRNT SDK for iOS including libraries for supporting application development for Star printers.
Stars: ✭ 24 (-11.11%)
Mutual labels:  printer
chrome-raw-print
Chrome app to enable raw printing from a browser
Stars: ✭ 57 (+111.11%)
Mutual labels:  printer
bootstrap-print
To manage print media for Twitter Bootstrap v3.
Stars: ✭ 60 (+122.22%)
Mutual labels:  printer
posprinterdriver
Android ESC/POS Printer Driver (https://play.google.com/store/apps/details?id=com.fidelier.posprinterdriver) usage notes
Stars: ✭ 61 (+125.93%)
Mutual labels:  escpos
ansible-cups
Ansible role to install and configure CUPS, assist with installing PPDs and install printers/classes
Stars: ✭ 20 (-25.93%)
Mutual labels:  printer
Cocoa-Printer-Server
Make your USB Printers to IP Printers.
Stars: ✭ 22 (-18.52%)
Mutual labels:  printer
react-native-thermal-printer
No description or website provided.
Stars: ✭ 36 (+33.33%)
Mutual labels:  printer
WSD-python
Web Services for Devices (WSD) tools and utilities for cross platform support
Stars: ✭ 22 (-18.52%)
Mutual labels:  printer
pio
Low-level package that provides an easy way to centralize different output targets. Supports colors and text decoration to all popular terminals
Stars: ✭ 21 (-22.22%)
Mutual labels:  printer
BadgeHub
Raspberry Pi, Dymo Turbo Writer 450 badge printing service that logs user information such as name and email and prints a name badge and QR code associated with that information.
Stars: ✭ 25 (-7.41%)
Mutual labels:  printer
ioBroker.epson stylus px830
Zustand Druckerpatronen im EPSON Stylus PX830 für ioBroker auslesen
Stars: ✭ 18 (-33.33%)
Mutual labels:  printer
nativescript-star-printer
🌟 Print directly to Star Micronics printers from your NativeScript app! http://www.starmicronics.com/
Stars: ✭ 28 (+3.7%)
Mutual labels:  printer
homebridge-printer
Homebridge plugin for ipp (AirPrint) capable printer
Stars: ✭ 30 (+11.11%)
Mutual labels:  printer
ErpNet.FP
ErpNet.FP is a light-weight cross-platform Http server facilitating printing to fiscal printers through simple JSON Api.
Stars: ✭ 75 (+177.78%)
Mutual labels:  printer

ESCPOS

Python library to manipulate ESC/POS Printers.

1. Dependencies

In order to start getting access to your printer, you must ensure you have previously installed the following python modules:

  • pyusb (python-usb)
  • Pillow

2. 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 standard usage is send raw text to the printer, but in also helps the user to enhance the experience with those printers by facilitating the bar code printing in many different standards, as well as manipulating images so they can be printed as brand logo or any other usage images migh have.

Text can be aligned/justified and fonts can be changed by size, type and weight.

Also, this module handles some hardware functionalities like, cut paper, carrier return, printer reset and others concerned to the carriage alignment.

3. Define your printer

Before start create your Python ESC/POS printer instance, you must see at your system for the printer parameters. This is done with the 'lsusb' command.

First run the command to look for the "Vendor ID" and "Product ID", then write down the values, these values are displayed just before the name of the device with the following format:

xxxx:xxxx

Example:

Bus 002 Device 001: ID 1a2b:1a2b Device name

Write down the the values in question, then issue the following command so you can get the "Interface" number and "End Point"

lsusb -vvv -d xxxx:xxxx | grep iInterface lsusb -vvv -d xxxx:xxxx | grep bEndpointAddress | grep OUT

The first command will yields the "Interface" number that must be handy to have and the second yields the "Output Endpoint" address.

By default the "Interface" number is "0" and the "Output Endpoint" address is "0x82", if you have other values then you can define with your instance.

4. Define your instance

The following example shows how to initialize the Epson TM-TI88IV

NOTE: Always finish the sequence with Epson.cut() otherwise you will endup with weird chars being printed.

from escpos import *

""" Seiko Epson Corp. Receipt Printer M129 Definitions (EPSON TM-T88IV) """
Epson = escpos.Escpos(0x04b8,0x0202,0)
Epson.text("Hello World")
Epson.image("logo.gif")
Epson.barcode
Epson.barcode('1324354657687','EAN13',64,2,'','')
Epson.cut()

or use with statement:

with EscposIO(printer.Network('192.168.1.87', port=9100)) as p:
    p.set(font='a', codepage='cp1251', size='normal', align='center', bold=True)
    p.printer.set(align='center')
    p.printer.image('logo.gif')
    p.writelines('Big line\n', font='b')
    p.writelines(u'Привет', color=2)
    p.writelines(u'BIG TEXT', size='2x')

# After exit of with, printer will cut the paper

5. API

  • Escpos() - main class
  • Escpos.image(path_img) - Open image file
  • Escpos.qr(text, *args, **kwargs) - Print QR Code for the provided string
  • Escpos.barcode(code, bc, width, height, pos, font) - Print Barcode
  • Escpos.text(text) - Print any text
  • Escpos.set(codepage=None, **kwargs) - kwargs should be:
    • bold: set bold font
    • underline: underline text
    • size: Text size
    • font: Font type
    • align: Text position
    • inverted: White on black text
    • color: Text color
  • Escpos.cut() - Cut the paper
  • Escpos.cashdraw(pin) - Send open cashdraw signal to printer pin.
  • Escpos.control() and Escpos.hw() - Should be use it when you want to do another operations.
  • EscposIO(printer, autocut=True, autoclose=True) - class for using with 'with' statement. When autocut=False printer not cut the paper after exit of "with".
  • EscposIO.set(**kwargs) - set the params in printing stream
    • bold: set bold font
    • underline: underline text
    • size: Text size
    • font: Font type
    • align: Text position
    • inverted: White on black text
    • color: Text color
  • EscposIO.writelines(text, **params) - Accept params like "set", and apply them for this lines. You should use set() for setting common params.

6. Links

Please visit project homepage at: http://repo.bashlinux.com/projects/escpos.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].