This commit is contained in:
zman 2025-04-07 17:49:19 -04:00
parent 357e47cc73
commit fe07e61505

17
app.py
View File

@ -54,11 +54,18 @@ def print_address_label(pdf_path):
image = convert_pdf_to_image(pdf_path)
if not image:
raise Exception("Failed to create label images")
target_width = 1164
target_height = 1660
image = image.convert("RGB")
image = image.resize((target_width, target_height), Image.LANCZOS)
if 'address' in pdf_path.lower():
target_width = 1660
target_height = 1164
image = image.convert("RGB")
image = image.resize((target_width, target_height), Image.LANCZOS)
image = image.rotate(90, expand=True)
else:
target_width = 1164
target_height = 1660
image = image.convert("RGB")
image = image.resize((target_width, target_height), Image.LANCZOS)
qlr = BrotherQLRaster(printer_model)
qlr.exception_on_warning = True