diff --git a/app.py b/app.py index 3a472be..d12baab 100644 --- a/app.py +++ b/app.py @@ -57,18 +57,18 @@ def convert_pdf_to_images(pdf_path): # Function to print address labels def print_address_label(images, pdf_path): try: - - 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) + for image in images: + 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