Skip to content

Instantly share code, notes, and snippets.

@MonsieurV
Created November 9, 2016 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MonsieurV/58c94e687ae5ccf9ee5212671e0a85bc to your computer and use it in GitHub Desktop.
Save MonsieurV/58c94e687ae5ccf9ee5212671e0a85bc to your computer and use it in GitHub Desktop.
PyFPDF -- Images concatenation in PDF file
# Code from http://stackoverflow.com/a/27327984/1956471
from fpdf import FPDF
pdf = FPDF('P', 'mm', 'A4')
for image in ['file1.jpg', 'file2.jpg', 'file3.jpg', 'file4.jpg', 'file5.jpg']:
pdf.add_page()
# Take full page.
# Doc. https://pyfpdf.readthedocs.io/en/latest/reference/image/index.html
pdf.image(image, 0, 5, 210)
pdf.output("output.pdf", "F")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment