Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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