This commit is contained in:
zman 2025-04-08 11:55:30 -04:00
parent a37918fe11
commit fa71c39780

24
app.py
View File

@ -57,18 +57,18 @@ def convert_pdf_to_images(pdf_path):
# Function to print address labels # Function to print address labels
def print_address_label(images, pdf_path): def print_address_label(images, pdf_path):
try: try:
for image in images:
if 'address' in pdf_path.lower(): if 'address' in pdf_path.lower():
target_width = 1660 target_width = 1660
target_height = 1164 target_height = 1164
image = image.convert("RGB") image = image.convert("RGB")
image = image.resize((target_width, target_height), Image.LANCZOS) image = image.resize((target_width, target_height), Image.LANCZOS)
image = image.rotate(90, expand=True) image = image.rotate(90, expand=True)
else: else:
target_width = 1164 target_width = 1164
target_height = 1660 target_height = 1660
image = image.convert("RGB") image = image.convert("RGB")
image = image.resize((target_width, target_height), Image.LANCZOS) image = image.resize((target_width, target_height), Image.LANCZOS)
qlr = BrotherQLRaster(printer_model) qlr = BrotherQLRaster(printer_model)
qlr.exception_on_warning = True qlr.exception_on_warning = True