Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am tying to merge 1500-1600 PDFs. Thanks to below link, I got a code to merge PDFs in python.

Merge PDF files

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()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
394 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...