I am tying to merge 1500-1600 PDFs. Thanks to below link, I got a code to merge PDFs in python.
However, it is resulting in a empty file, probably because there are digital signatures in the PDFs I am combining.
Can someone suggest a way to combine these files having digital signatures? I do not mind losing digital signature in the output file. (It is also ok, if there is a way to remove digital signatures from the source files and then combine them)
Code:
import os
from PyPDF2 import PdfFileMerger
os.chdir("C:\test")
x = [a for a in os.listdir() if a.endswith(".pdf")]
merger = PdfFileMerger()
for pdf in x:
pdfobject = open(pdf, 'rb')
merger.append(pdfobject)
pdfobject.close()
merger.write("result.pdf")
merger.close()