Merge branch 'merge/upstream/master'
This commit is contained in:
commit
242399ebe2
13
CHANGELOG
13
CHANGELOG
|
@ -22,3 +22,16 @@ CHANGELOG
|
||||||
- Added charcode tables
|
- Added charcode tables
|
||||||
- Fixed Horizontal Tab
|
- Fixed Horizontal Tab
|
||||||
- Fixed code tabulators
|
- Fixed code tabulators
|
||||||
|
|
||||||
|
* 2015-04-21 - Version 1.0.5
|
||||||
|
- Merge pull request #45 from Krispy2009/master
|
||||||
|
. Raising the right error when wrong charcode is used
|
||||||
|
. Sent by Krispy2009@gmail.com
|
||||||
|
|
||||||
|
* 2015-07-06 - Version 1.0.6
|
||||||
|
- Merge pull request #53 from ldos/master
|
||||||
|
. Extended params for serial printers
|
||||||
|
. Sent by cafeteria.ldosalzira@gmail.com
|
||||||
|
|
||||||
|
* 2015-08-22 - Version 1.0.7
|
||||||
|
- Issue #57: Fixed transparent images
|
||||||
|
|
18
README
18
README
|
@ -72,7 +72,7 @@ The following example shows how to initialize the Epson TM-TI88IV
|
||||||
from escpos import *
|
from escpos import *
|
||||||
|
|
||||||
""" Seiko Epson Corp. Receipt Printer M129 Definitions (EPSON TM-T88IV) """
|
""" Seiko Epson Corp. Receipt Printer M129 Definitions (EPSON TM-T88IV) """
|
||||||
Epson = escpos.Escpos(0x04b8,0x0202,0)
|
Epson = escpos.Escpos(0x04b8,0x0202)
|
||||||
Epson.text("Hello World")
|
Epson.text("Hello World")
|
||||||
Epson.image("logo.gif")
|
Epson.image("logo.gif")
|
||||||
Epson.barcode
|
Epson.barcode
|
||||||
|
@ -82,8 +82,20 @@ The following example shows how to initialize the Epson TM-TI88IV
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
5. Links
|
5. Links
|
||||||
|
|
||||||
Please visit project homepage at:
|
Please visit project documentation at:
|
||||||
http://repo.bashlinux.com/projects/escpos.html
|
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 <manpaz@bashlinux.com>
|
Manuel F Martinez <manpaz@bashlinux.com>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
@author: Manuel F Martinez <manpaz@bashlinux.com>
|
@author: Manuel F Martinez <manpaz@bashlinux.com>
|
||||||
@organization: Bashlinux
|
@organization: Bashlinux
|
||||||
@copyright: Copyright (c) 2012 Bashlinux
|
@copyright: Copyright (c) 2012 Bashlinux
|
||||||
@license: GPL
|
@license: GNU GPL v3
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -111,7 +111,15 @@ class Escpos:
|
||||||
def image(self,path_img):
|
def image(self,path_img):
|
||||||
""" Open image file """
|
""" Open image file """
|
||||||
im_open = Image.open(path_img)
|
im_open = Image.open(path_img)
|
||||||
im = im_open.convert("RGB")
|
|
||||||
|
# Remove the alpha channel on transparent images
|
||||||
|
if im_open.mode == 'RGBA':
|
||||||
|
im_open.load()
|
||||||
|
im = Image.new("RGB", im_open.size, (255, 255, 255))
|
||||||
|
im.paste(im_open, mask=im_open.split()[3])
|
||||||
|
else:
|
||||||
|
im = im_open.convert("RGB")
|
||||||
|
|
||||||
# Convert the RGB image in printable image
|
# Convert the RGB image in printable image
|
||||||
self._convert_image(im)
|
self._convert_image(im)
|
||||||
|
|
||||||
|
@ -155,6 +163,7 @@ class Escpos:
|
||||||
qr_code.make(fit=True)
|
qr_code.make(fit=True)
|
||||||
qr_img = qr_code.make_image()
|
qr_img = qr_code.make_image()
|
||||||
im = qr_img._img.convert("RGB")
|
im = qr_img._img.convert("RGB")
|
||||||
|
|
||||||
# Convert the RGB image in printable image
|
# Convert the RGB image in printable image
|
||||||
self._convert_image(im)
|
self._convert_image(im)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
@author: Manuel F Martinez <manpaz@bashlinux.com>
|
@author: Manuel F Martinez <manpaz@bashlinux.com>
|
||||||
@organization: Bashlinux
|
@organization: Bashlinux
|
||||||
@copyright: Copyright (c) 2012 Bashlinux
|
@copyright: Copyright (c) 2012 Bashlinux
|
||||||
@license: GPL
|
@license: GNU GPL v3
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import usb.core
|
import usb.core
|
||||||
|
@ -70,24 +70,40 @@ class Usb(Escpos):
|
||||||
class Serial(Escpos):
|
class Serial(Escpos):
|
||||||
""" Define Serial printer """
|
""" Define Serial printer """
|
||||||
|
|
||||||
def __init__(self, devfile="/dev/ttyS0", baudrate=9600, bytesize=8, timeout=1, *args, **kwargs):
|
def __init__(self, devfile="/dev/ttyS0", baudrate=9600, bytesize=8, timeout=1,
|
||||||
|
parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,
|
||||||
|
xonxoff=False , dsrdtr=True, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
@param devfile : Device file under dev filesystem
|
@param devfile : Device file under dev filesystem
|
||||||
@param baudrate : Baud rate for serial transmission
|
@param baudrate : Baud rate for serial transmission
|
||||||
@param bytesize : Serial buffer size
|
@param bytesize : Serial buffer size
|
||||||
@param timeout : Read/Write timeout
|
@param timeout : Read/Write timeout
|
||||||
|
|
||||||
|
@param parity : Parity checking
|
||||||
|
@param stopbits : Number of stop bits
|
||||||
|
@param xonxoff : Software flow control
|
||||||
|
@param dsrdtr : Hardware flow control (False to enable RTS/CTS)
|
||||||
"""
|
"""
|
||||||
Escpos.__init__(self, *args, **kwargs)
|
Escpos.__init__(self, *args, **kwargs)
|
||||||
self.devfile = devfile
|
self.devfile = devfile
|
||||||
self.baudrate = baudrate
|
self.baudrate = baudrate
|
||||||
self.bytesize = bytesize
|
self.bytesize = bytesize
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
|
|
||||||
|
self.parity = parity
|
||||||
|
self.stopbits = stopbits
|
||||||
|
self.xonxoff = xonxoff
|
||||||
|
self.dsrdtr = dsrdtr
|
||||||
|
|
||||||
self.open()
|
self.open()
|
||||||
|
|
||||||
|
|
||||||
def open(self):
|
def open(self):
|
||||||
""" Setup serial port and set is as escpos device """
|
""" Setup serial port and set is as escpos device """
|
||||||
self.device = serial.Serial(port=self.devfile, baudrate=self.baudrate, bytesize=self.bytesize, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=self.timeout, dsrdtr=True)
|
self.device = serial.Serial(port=self.devfile, baudrate=self.baudrate,
|
||||||
|
bytesize=self.bytesize, parity=self.parity,
|
||||||
|
stopbits=self.stopbits, timeout=self.timeout,
|
||||||
|
xonxoff=self.xonxoff, dsrdtr=self.dsrdtr)
|
||||||
|
|
||||||
if self.device is not None:
|
if self.device is not None:
|
||||||
print("Serial printer enabled")
|
print("Serial printer enabled")
|
||||||
|
@ -160,6 +176,10 @@ class File(Escpos):
|
||||||
if self.device is None:
|
if self.device is None:
|
||||||
print("Could not open the specified file %s" % self.devfile)
|
print("Could not open the specified file %s" % self.devfile)
|
||||||
|
|
||||||
|
def flush(self):
|
||||||
|
"""Flush printing content"""
|
||||||
|
self.device.flush()
|
||||||
|
|
||||||
|
|
||||||
def _raw(self, msg):
|
def _raw(self, msg):
|
||||||
""" Print any command sent in raw format """
|
""" Print any command sent in raw format """
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -4,9 +4,9 @@ from distutils.core import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='escpos',
|
name='escpos',
|
||||||
version='1.0-4',
|
version='1.0.7',
|
||||||
url='http://code.google.com/p/python-escpos',
|
url='https://github.com/manpaz/python-escpos',
|
||||||
download_url='http://python-escpos.googlecode.com/files/python-escpos-1.0.zip',
|
download_url='https://github.com/manpaz/python-escpos.git',
|
||||||
description='Python library to manipulate ESC/POS Printers',
|
description='Python library to manipulate ESC/POS Printers',
|
||||||
license='GNU GPL v3',
|
license='GNU GPL v3',
|
||||||
long_description=open('README').read(),
|
long_description=open('README').read(),
|
||||||
|
|
Loading…
Reference in New Issue