WhyNotHugo / python-barcode

㊙️ Create standard barcodes with Python. No external dependencies. 100% Organic Python.
http://python-barcode.rtfd.io/
MIT License
572 stars 123 forks source link

Wrong SVG generation for EAN13 #231

Open ildarworld opened 4 months ago

ildarworld commented 4 months ago

Don't know, is that a border case, but package generates wrong image for '5032783267860' in EAN13. its generate barcode for '5032783267863'. Generated file attached:

5032783267860

To reproduce the issue it just use following.

import barcode
from barcode.writer import SVGWriter

barcoder = barcode.get_barcode_class('EAN13')
writer = SVGWriter()
barcode_image = barcoder('5032783267860', writer=writer)
barcode_image.save('~/5032783267860.svg')
WhyNotHugo commented 2 months ago

The last digit is the verification digit, and this library will calculate it for you. If you want to force the provided digit, you need to use no_checksum=True.