Merge Pdfs automatically in a folder based on the file names.
Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vscode
READMEImages
LICENSE.md
README.md
mergefiles.py
mergepdfs.py
parsepdfsfile.py

README.md

Merge Pdfs

A python module to merge a bunch of Pdf files.


Why would you want to merge bunch of pdf files?

A few months ago now, I purchased this mobile scanner . The IRIScan Anywhere scanner.

IRIScan Anywhere 5

This scanner is very portable and I am using it very often to scan all sort of documents I am receiving over mail and that I want to archive to be sure that I have a digital copy.

It is also useful to scan and store the receipt I receive from stores.

but

The scanner can't merge files during scanning. It must be done on post-processing through their software.

That's why I wanted to automate the process a little.


1. Prepare your files.

Let's consider that you scan (or have by any other method) a lot of different pdf files.

You need to rename your files according to the following pattern :

"file name1 - part1.pdf"

...

"file name1 - partN.pdf"

"file name2 - part1.pdf"

...

"file name2 - partN.pdf"

See a folder that is properly prepared on the image below :

Scanned Images Folder

The files that have the same name ("file name1" for instance) are going to be merged together.

2. Installation of the required softwares.

As a start, you need to install the PyPDF2 python module to your computer as it is necessary to manipulate the pdf files.

pip install PyPDF2

3. Call the module

You could then call the module like this, when you are in the folder that has the "mergepdfs.py" file :

mergepdfs.py ./path/to/the/pdf/files/I/want/to/merge

I use powershell to do this on Windows :

and you can see that the files were merged properly.

4. Enjoy the results

A "result" directory is created to store the merged files.

Then the files are named as were their parts and available in the "result" folder.




Released under the Mozilla Public License, version 2.0
Made with ❤️ in Paris 🇫🇷