Skip to content

Instantly share code, notes, and snippets.

@rounakdatta
Created May 27, 2018 07:17
Show Gist options
  • Save rounakdatta/3a0d3964e5696610d7a0ae3b466856c0 to your computer and use it in GitHub Desktop.
Save rounakdatta/3a0d3964e5696610d7a0ae3b466856c0 to your computer and use it in GitHub Desktop.
Quickly merge PDF files
from PyPDF2 import PdfFileMerger
pdfs = ['one.pdf', 'two.pdf']
merger = PdfFileMerger()
for pdf in pdfs:
merger.append(open(pdf, 'rb'))
with open('final.pdf', 'wb') as fout:
merger.write(fout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment