python-barcode
python-barcode copied to clipboard
Wrong SVG generation for EAN13
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:
To reproduce the issue it just use following.
- macOS Sonoma 14.5
- chip Apple M1
- python-barcode 0.15.1
- python version 3.11.9
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')
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.