how to combine pdf's to become one wit python code example
Example 1: python merge pdfs
from PyPDF2 import PdfFileMerger, PdfFileReader
merger = PdfFileMerger()
merger.append(PdfFileReader(open(filename1, 'rb')))
merger.append(PdfFileReader(open(filename2, 'rb')))
merger.write("merged.pdf")
Example 2: python merge pdf files into one
from PyPDF2 import PdfFileMerger, PdfFileReader
mergedObject = PdfFileMerger()
for fileNumber in range(1, 117):
mergedObject.append(PdfFileReader('6_yuddhakanda_' + str(fileNumber)+ '.pdf', 'rb'))
mergedObject.write("mergedfilesoutput.pdf")