h
This commit is contained in:
parent
963a59d2d4
commit
a37918fe11
7
app.py
7
app.py
@ -55,7 +55,7 @@ def convert_pdf_to_images(pdf_path):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# Function to print address labels
|
# Function to print address labels
|
||||||
def print_address_label(image, pdf_path):
|
def print_address_label(images, pdf_path):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
if 'address' in pdf_path.lower():
|
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...")
|
app.logger.info("Converting image to printer instructions...")
|
||||||
instructions = convert(
|
instructions = convert(
|
||||||
qlr=qlr,
|
qlr=qlr,
|
||||||
images=[image], # Pass as a list with the single image
|
images=images,
|
||||||
label='102x152',
|
label='102x152',
|
||||||
threshold=70.0,
|
threshold=70.0,
|
||||||
dither=False,
|
dither=False,
|
||||||
@ -111,8 +111,7 @@ def process_queue():
|
|||||||
app.logger.info(f"Processing file: {file_path}")
|
app.logger.info(f"Processing file: {file_path}")
|
||||||
images = convert_pdf_to_images(file_path)
|
images = convert_pdf_to_images(file_path)
|
||||||
if images:
|
if images:
|
||||||
for image in images:
|
print_address_label(images, file_path)
|
||||||
print_address_label(image, file_path)
|
|
||||||
else:
|
else:
|
||||||
app.logger.error(f"Failed to convert PDF to images: {file_path}")
|
app.logger.error(f"Failed to convert PDF to images: {file_path}")
|
||||||
# Signal that the task is done
|
# Signal that the task is done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user