Skip to content

Instantly share code, notes, and snippets.

@juice500ml
Created April 24, 2025 15:29
Show Gist options
  • Save juice500ml/94f660651c6c5a43d3f4e03ad7ef45c7 to your computer and use it in GitHub Desktop.
Save juice500ml/94f660651c6c5a43d3f4e03ad7ef45c7 to your computer and use it in GitHub Desktop.
PDF merger
from pathlib import Path
from pypdf import PdfWriter
pdfs = sorted(str(x) for x in Path(".").glob("*.pdf") if str(x) != "full.pdf")
merger = PdfWriter()
for pdf in pdfs:
print(pdf)
merger.append(pdf)
merger.write("full.pdf")
merger.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment