Skip to content

Instantly share code, notes, and snippets.

@billfitzgerald
Created January 30, 2024 18:47
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 billfitzgerald/2710b75b360d10a80343694991b7f342 to your computer and use it in GitHub Desktop.
Save billfitzgerald/2710b75b360d10a80343694991b7f342 to your computer and use it in GitHub Desktop.
Simple ugly script to merge pdfs - while pdfs are the Devil's Own Format, they are useful on occasion
from pypdf import PdfMerger
pdfs = ['pdf_1.pdf', 'pdf_2.pdf'] # pdfs to be merged, in order
output_name = 'merged_pdf' # filename of the merged pdfs
merger = PdfMerger()
for pdf in pdfs:
merger.append(pdf)
merger.write(output_name)
merger.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment