Skip to content

Instantly share code, notes, and snippets.

@harajune
Created May 20, 2022 10:44
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 harajune/eb93d4ee840059d4ab6b615e1a4e35af to your computer and use it in GitHub Desktop.
Save harajune/eb93d4ee840059d4ab6b615e1a4e35af to your computer and use it in GitHub Desktop.
def writeMergedPdf(pdfParameter1, pdfParameter2, outputFileName):
merger = PdfMerger(outputFileName)
pdf1 = Pdf(pdfParameter1)
pdf1.load()
pdf2 = Pdf(pdfParameter2)
pdf2.load()
validatePdf(pdf1, pdf2)
# usually, pdf1 is greater than pdf2
while pdf1.next():
merger.append(pdf1)
if pdf2.next():
merger.append(pdf2)
merger.write()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment