This commit is contained in:
zman 2025-04-08 11:42:42 -04:00
parent 963a59d2d4
commit a37918fe11

7
app.py
View File

@ -55,7 +55,7 @@ def convert_pdf_to_images(pdf_path):
return None
# Function to print address labels
def print_address_label(image, pdf_path):
def print_address_label(images, pdf_path):
try:
if 'address' in pdf_path.lower():
@ -76,7 +76,7 @@ def print_address_label(image, pdf_path):
app.logger.info("Converting image to printer instructions...")
instructions = convert(
qlr=qlr,
images=[image], # Pass as a list with the single image
images=images,
label='102x152',
threshold=70.0,
dither=False,
@ -111,8 +111,7 @@ def process_queue():
app.logger.info(f"Processing file: {file_path}")
images = convert_pdf_to_images(file_path)
if images:
for image in images:
print_address_label(image, file_path)
print_address_label(images, file_path)
else:
app.logger.error(f"Failed to convert PDF to images: {file_path}")
# Signal that the task is done