asdf
This commit is contained in:
parent
fa71c39780
commit
72d19bd8b0
5
app.py
5
app.py
@ -57,6 +57,7 @@ def convert_pdf_to_images(pdf_path):
|
||||
# Function to print address labels
|
||||
def print_address_label(images, pdf_path):
|
||||
try:
|
||||
processed_images = []
|
||||
for image in images:
|
||||
if 'address' in pdf_path.lower():
|
||||
target_width = 1660
|
||||
@ -64,11 +65,13 @@ def print_address_label(images, pdf_path):
|
||||
image = image.convert("RGB")
|
||||
image = image.resize((target_width, target_height), Image.LANCZOS)
|
||||
image = image.rotate(90, expand=True)
|
||||
processed_images.append(image)
|
||||
else:
|
||||
target_width = 1164
|
||||
target_height = 1660
|
||||
image = image.convert("RGB")
|
||||
image = image.resize((target_width, target_height), Image.LANCZOS)
|
||||
processed_images.append(image)
|
||||
|
||||
qlr = BrotherQLRaster(printer_model)
|
||||
qlr.exception_on_warning = True
|
||||
@ -76,7 +79,7 @@ def print_address_label(images, pdf_path):
|
||||
app.logger.info("Converting image to printer instructions...")
|
||||
instructions = convert(
|
||||
qlr=qlr,
|
||||
images=images,
|
||||
images=processed_images,
|
||||
label='102x152',
|
||||
threshold=70.0,
|
||||
dither=False,
|
||||
|
Loading…
x
Reference in New Issue
Block a user