forked from python-escpos/python-escpos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
101 lines (71 loc) · 3.21 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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)
* PIL (Python Image Library)
------------------------------------------------------------------
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)
Epson.text("Hello World")
Epson.image("logo.gif")
Epson.barcode
Epson.barcode('1324354657687','EAN13',64,2,'','')
Epson.cut()
------------------------------------------------------------------
5. Links
Please visit project documentation at:
https://github.com/manpaz/python-escpos/wiki
------------------------------------------------------------------
6. Donations
There are some different prints I'd like to acquire, but unfortunately
not all, even used, are cheaper and easy to get.
If you want to help funding money to get more printers or just want to
donate because you like the project, please be in touch and I'll be
sending my PayPal info so you can donate.
Thank you!
Manuel F Martinez <[email protected]>