Python merge PDFs

Using python script to merge pdfs together.

Install package

pip install pypdf

Script:

from pypdf import PdfWriter

pdfs = ['file1.pdf', 'file2.pdf', 'file3.pdf', 'file4.pdf']

#merger = PdfMerger()
merger = PdfWriter()

for pdf in pdfs:
    merger.append(pdf)

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

source

social