Created
May 21, 2021 14:23
-
-
Save jmrenouard/99d84396b464022461192495bd5b6dfa to your computer and use it in GitHub Desktop.
Merge several PDF files into one unique File
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
from PyPDF2 import PdfFileMerger | |
import glob | |
import sys | |
pdfs = sys.argv[1:] | |
#['Planche1.pdf', 'Planche2.pdf'] | |
out=pdfs.pop() | |
print("File to merge :" +str(pdfs)) | |
print("Result File :" +out) | |
merger = PdfFileMerger() | |
for pdf in pdfs: | |
merger.append(pdf) | |
merger.write(out) | |
merger.close() |
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
# pip3 install PyPDF2 | |
# python3 merger.py result_file.pdf file1.pdf file2.pdf somedir/*.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment