A simple Python script to combine multiple PDF files into one PDF file.
- Open the Python script in your code editor.
- In
pdf_files = ["file1.pdf", "file2.pdf", "file3.pdf"]
replace file1.pdf etc. with the actual file paths of the PDFs you want to merge. You can, of course, add more or less files than three; simply continue adding more PDF file paths following the same pattern. - In
output_pdf = "PDF_combined.pdf"
replace PDF_combined.pdf with the desired name for the merged PDF file. - In
output_directory = "/path/to/output/directory/"
replace /path/to/output/directory/ with your desired output directory path for the merged PDF file. - Save the script and you're ready to go.
To run this Python scripts you need to have the PyPDF2 library in your terminal, you can install it using pip: pip install PyPDF2
.
Scripts written with the help of GPT-3.5.