Open israelcoper opened 3 years ago
I had this issue aswell, its not totally clear in the documentation but you can pass the options to .write() instead:
Code128(value, writer=writer).write(file_like_object, options={'<option>': <value>})
Use the options this way ,
from barcode import ITF
from io import BytesIO
stream = BytesIO()
options = {
"module_width": 0.1,
"module_height": 2,
"quiet_zone": 0.1,
"write_text": False,
"text_distance": 2,
}
Code128(code_str, writer=writer1, narrow=1, wide=3).write(stream, options)
I did it this way, hoping it can help you.
from barcode.writer import ImageWriter
from barcode import Code128
code128 = Code128(code, writer=ImageWriter())
code128.save(filename=f"{code}", options={"module_width": 0.5})
Here's my code: