A simple command-line tool written in Python to merge multiple PDF files into a single file.
This project was created as a learning exercise using argparse, pathlib and pypdf.
- Merge multiple PDF files
- Keep files in the order provided
- Validate input paths
- Validate
.pdfextensions - Choose the output file
- Python 3
pypdf
Clone the repository:
git clone https://github.com/iamsaturn/MergeMyPDF.git
cd MergeMyPDFCreate and activate a virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Install the dependencies:
pip install -r requirements.txtPass the PDF files in the order you want to merge them, followed by the output file:
python main.py first.pdf second.pdf -o merged.pdfYou can merge more than two files:
python main.py first.pdf second.pdf third.pdf -o merged.pdfYou can also use full paths:
python main.py "C:\Documents\first.pdf" "C:\Documents\second.pdf" -o "C:\Documents\merged.pdf"To see the available arguments:
python main.py --help