[PYTHON] Combine PDF pages, copy and paste series immediately

Combine PDF files

I use PDF merging occasionally, so I can use it immediately for myself. Requires pip installation of PyPDF2. that's all.

merge_pdf.py


import PyPDF2

#Combine separate pdf files
def merge_pdf(pdf_files):
    merger = PyPDF2.PdfFileMerger()
    for pdf in pdf_files:
        merger.append(pdf)

    merger.write("merge.pdf")
    merger.close()

if __name__ == "__main__":
    pdf_files = ["a.pdf","b.pdf"]
    merge_pdf(pdf_files)    

Recommended Posts

Combine PDF pages, copy and paste series immediately
Renumber PDF pages
[Copy and paste OK] Basic Linux command collection [18 selections]