python-barcode icon indicating copy to clipboard operation
python-barcode copied to clipboard

When using an ImageWriter with 'Code39' the add_checksum option is ignored

Open srolin opened this issue 6 years ago • 3 comments

When using the generator function to create a 'Code39' barcode, the writer_options={'add_checksum': False} is ignored.

The addition of the check digit happens during the class init which hasn't received the writer_options.

I have a fix for this by moving the check into the render function and adding an instance variable to track when it has been added. (I wasn't sure if the render function could end up being called more than once and didn't want additional check digits adding.

Will create a PR for the fix.

srolin avatar Oct 28 '19 00:10 srolin

Breaking code: generate('code39', my_bar_code, writer=ImageWriter(), output='fp_svg', writer_options={'add_checksum': False}) Continued to add a checksum.

srolin avatar Oct 28 '19 14:10 srolin

I believe this is fixed. Lemme know if you still have any issues.

WhyNotHugo avatar Feb 25 '20 01:02 WhyNotHugo

I still have this issue on version 0.14. Did something change?

c_barcode = '201822052211050114571102' barcode.generate('code39', c_barcode, output='barcode_image', writer=ImageWriter(), writer_options={ 'add_checksum': False})

It renders a letter at the end of the generated code.

barcode_image

enricogalli avatar May 22 '22 09:05 enricogalli