Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
No barcode printing with WinBond/Zjiang 5890 #58
It took me a while to find the problem. My 5802LD from the same manufacture demands a NUL last in the data field. Python-escpos only sends 'self._raw(code)' NOT self._raw(code+'\0'). A work around is to use a line like: Zjiang.barcode('1324354657687\0','EAN13',64,2,'','') OBS! the '\0'.
By the way the Zjiang manual is a typographical disaster with many errors!
referenced this issue
Mar 7, 2016
pushed a commit
Mar 8, 2016
I have this printer http://www.amazon.de/gp/product/B00LUIST7W/ref=ask_ql_qh_dp_hza
Hi @bondzo, the Text with a leading @ should go into a Barcode. So it looks like there is a fault somewhere.
Yes, I tried several _raw sequences - no success.
I've tried using the pyBarcode library to generate barcode images for python-escpos
Printing "1234" in CODE39 showed a few bugs and missing features. Most of it's in the bug tracker, see bitbucket.
Dependencies for this snippet:
pip install python-escpos pyBarcode
Hacky setup to get a PIL object out without writing to disk:
import barcode from barcode.writer import ImageWriter def get_barcode_image(codetype, content): """ Get a PIL image object from a given barcode type and content. Note that barcode.PROVIDED_BARCODES contains the list of valid barcode types. """ barcode_class=barcode.get_barcode_class(codetype) my_code=barcode_class(content, writer=ImageWriter()) my_code.write("/dev/null") return my_code.writer._image
The idea being that you could print it:
from escpos.printer import File myPrinter = File("/dev/usb/lp0") img = get_barcode_image("code39", "1234") myPrinter.image(img, impl='bitImageColumn')
Unfortunately, no chance to set the size, and the output is buggy as anything. Debug time:
img.save(open("aa.png", "wb"), format="png")
In the absence of any other suggestions for getting barcodes on the ZJ5890, I think we can close this issue off.
For anyone dealing with a printer which does not support
@mike42, I tried your example with pyBarcode 0.8beta1 from their hg repository with a
Get a copy of zxing/zxing for Android to test this.
Very few of the barcodes I generated could be scanned correctly. If you see those sorts of bugs, they should be replicated with a snippet that does not use
I am also aware of the CUPS filter. The CUPS print pipeline makes an image out of an entire page for the filter to convert, so if you can print text/images, and you have barcodes in a HTML or PDF document, this may work for you.
I have the same printer and was able to print legible bar codes using pyBarcode (last beta has code128). Beware that if the barcode is too long in length the printer with roll and roll a lot of paper. An image-too-large exception should be implemented too in order to not waste paper.
I propose a feature to add barcode software rendering in order to fix this problem. The issue should be created appart and this issue closed for simpler identification for contributors.