Hello, new to the group, rather new to programming.
I'm writing a program that takes images and converts them into PDF's. It works
after quite a few days of trying, however the final file has a blank page
inserted before and after each page containing the images.
This uses FPDF to do the conversion. I've been up and down trying to figure out
where I'm adding an extra page, so it might be an FPDF issue.
def multi_convert(pdf_Filename, file_path):
if (dir):
file_list = []
print(""), print("")
print("Converting... This may take awhile depending on the number of
images.")
for entry in os.scandir(file_path):
if (entry.path.endswith(".jpg") or entry.path.endswith(".png")) and
entry.is_file():
file_list.append(entry.path)
else:
print("Error: ")
print("Invalid Directory - {}", dir)
cover = Image.open(str(file_list[0]))
width, height = cover.size
pdf = FPDF(unit="pt", format=[width, height])
for page in file_list:
pdf.add_page()
pdf.image(str(page))
pdf.output(file_path + pdf_Filename + ".pdf", "F")
exit()
--
https://mail.python.org/mailman/listinfo/python-list