Skip to content

Instantly share code, notes, and snippets.

@harurunrunrun
harurunrunrun / merge_PDF.py
Last active November 5, 2022 13:54
merge PDF files on Python
# if you have not finished to install PyPDF2, please execute "pip install PyPDF2" or "{your python.exe path} -m pip install PyPDF2"
import PyPDF2
pdf_files=["A.pdf","B.pdf","C.pdf"] # write merged pdf files path in order
pdf_name="D.pdf" # write new pdf file path (you canNOT write the path in pdf_files)
mem=PyPDF2.PdfFileMerger()
for pdf_file in pdf_files:
mem.append(pdf_file)