Merge pull request #2 from brendanhowell/brendanhowell-patch-1

soft_barcode to render directly
This commit is contained in:
B. Howell 2021-12-21 23:49:04 +01:00 committed by GitHub
commit c99ed6988f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -603,18 +603,15 @@ class Escpos(object):
) )
) )
# Render the barcode to a fake file # Render the barcode
barcode_class = barcode.get_barcode_class(barcode_type) barcode_class = barcode.get_barcode_class(barcode_type)
my_code = barcode_class(data, writer=image_writer) my_code = barcode_class(data, writer=image_writer)
my_code.render(
with open(os.devnull, "wb") as nullfile: writer_options={
my_code.write(
nullfile,
{
"module_height": module_height, "module_height": module_height,
"module_width": module_width, "module_width": module_width,
"text_distance": text_distance, "text_distance": text_distance,
}, }
) )
# Retrieve the Pillow image and print it # Retrieve the Pillow image and print it