A script that combines multiple PDFs together to make 1 merged PDF.
This program was created to help me build on object-oriented programming concepts, automated testing as well as files and directories.
- Please ensure that you have Python version 3 installed on your computer. If you have not yet got the link, you can find the latest version of Python available using this link: https://www.python.org/downloads/
- Open https://github.com/nlutala/pdf-merger/ in a new tab.
- Press the green "<> Code" button and press "Download ZIP"
- Once downloaded, extract all files to a new folder
- Open your preferred terminal (command prompt, windows powershell etc.) in the directory where the requirements.txt file is located and write:
pip install -r requirements.txt
- Now you should have all the required libraries to run the project
Ensure you have 2 or more PDF files in the directory the pdf_merger.py file is in (see example below).
It doesn't matter if you don't as the script is written to handle for these cases (see below)
-
To run the script, write the following command in the terminal:
python pdf_merger.py
-
You will then be presented with this screen and prompted to enter the name of the new merged file.
-
You will then be able to find this file in a new folder called "merged-files".
-
Your original PDF files will also be moved a new folder called "original-files". (I have used the same example PDF files you can find in the Tests/ folder)
I hope this script is useful!
-
While testing this script on my computer, I have found that merging some PDF files could result in text being printed to the terminal that you may not be expecting. This can be ignored as a new merged PDF file is generated. Here is an example of an instance of me of merging my old university lecture slides into one PDF.
-
One small pointer would also be to perhaps number your PDFs if there is a specific order in how you would like them merged. This helps the pdf_merger preserve the same order in the final PDF it generates. For example, labelling three files file1.pdf, file2.pdf and file3.pdf will allow the pdf_merger to merge and create a PDF file showing the contents of file1.pdf, file2.pdf and then file3.pdf
Nathan Lutala, nlutala
- 0.1 - First release
Inspiration for writing this readme file