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

module_width not working #216

Closed ramazankoc88 closed 1 year ago

ramazankoc88 commented 1 year ago

Hello Here is a simple code that I use to generate Code128 but module width option does not change the width of the output SVG What could be wrong? Thank you

from barcode import Code128 from barcode.writer import SVGWriter

Code128.default_writer_options['write_text'] = True Code128.default_writer_options['module_height'] = 10 Code128.default_writer_options['module_width'] = 0.5

with open("somefile.svg", "wb") as f: Code128('TEMTEM9999', writer=SVGWriter()).write(f)

ramazankoc88 commented 1 year ago

Changed the code like this and it is working now

from io import BytesIO import base64 from barcode import Code128 from barcode.writer import SVGWriter

options = { "module_width": 0.5, "module_height": 10, "write_text": False }

with open("somefile.svg", "wb") as f: Code128('TEMTEM9999', writer=SVGWriter()).write(f, options)