Last active
October 22, 2021 13:43
-
-
Save Syncrossus/248a66ad98008a7c3c3b731686cfcb80 to your computer and use it in GitHub Desktop.
A script for merging PDF files which doesn't halt with a PdfReadError. No longer works with some newer PDFs. Based on this thread: https://github.com/mstamy2/PyPDF2/issues/244
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PyPDF2 as PDF | |
import sys | |
def pdf_cat(allPdfFiles): | |
merger = PDF.PdfFileMerger(strict=False) | |
for filename in allPdfFiles: | |
merger.append(PDF.PdfFileReader(filename, strict=False)) | |
merger.write("merged_full.pdf") | |
if __name__ == '__main__': | |
pdf_cat(sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
None of this code is mine. It is pieced together from posts on this issue thread.