WhyNotHugo / python-barcode

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

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

Open srolin opened 4 years ago

srolin commented 4 years ago

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 commented 4 years ago

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

WhyNotHugo commented 4 years ago

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

enricogalli commented 2 years ago

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