Create PDF from a list of images

Install FPDF for Python:

pip install fpdf

Now you can use the same logic:

from fpdf import FPDF
pdf = FPDF()
# imagelist is the list with all image filenames
for image in imagelist:
    pdf.add_page()
    pdf.image(image,x,y,w,h)
pdf.output("yourfile.pdf", "F")

You can find more info at the tutorial page or the official documentation.

Leave a Comment