Just adding on here, if you'd like to add all of your pages from your old PDF to your new PDF, then use the following in conjunction with the code above:
pdf_pages = existing_pdf.numPages
i = 0
while i < pdf_pages:
page = existing_pdf.getPage(i)
output.addPage(page)
i += 1
Just adding on here, if you'd like to add all of your pages from your old PDF to your new PDF, then use the following in conjunction with the code above:
pdf_pages = existing_pdf.numPages
i = 0
while i < pdf_pages:
page = existing_pdf.getPage(i)
output.addPage(page)
i += 1
outputStream = open("destination.pdf", "wb")
output.write(outputStream)
outputStream.close()