soft_barcode to render directly (#469)
Rendering to /dev/null by a call to .write causes an error. Calling .render directly is simpler and fixes the error. Co-authored-by: Patrick Kanzler <4189642+patkan@users.noreply.github.com>
This commit is contained in:
parent
5b72985b0a
commit
8bbbf7ceac
|
@ -602,19 +602,16 @@ 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(
|
"module_height": module_height,
|
||||||
nullfile,
|
"module_width": module_width,
|
||||||
{
|
"text_distance": text_distance,
|
||||||
"module_height": module_height,
|
}
|
||||||
"module_width": module_width,
|
)
|
||||||
"text_distance": text_distance,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
# Retrieve the Pillow image and print it
|
# Retrieve the Pillow image and print it
|
||||||
image = my_code.writer._image
|
image = my_code.writer._image
|
||||||
|
|
Loading…
Reference in New Issue