Simple CLI to merge multiple PDFs into one.
Project description
PDF Joiner
Python CLI to merge multiple PDFs into a single file, with configurable sorting.
Installation
pip install pdf-joiner
Install from source
git clone https://github.com/mariano-soto/pdf-joiner.git
cd pdf-joiner
pip install .
Install for development
git clone https://github.com/mariano-soto/pdf-joiner.git
cd pdf-joiner
pip install -e ".[dev]"
Quick usage
# Merge individual PDFs
pdfm a.pdf b.pdf c.pdf -o combined.pdf
# Merge all PDFs from a folder
pdfm ./my-documents -o result.pdf
# Merge sorted by modification date (newest first)
pdfm ./documents -o chronological.pdf --sort mtime --reverse
# Merge with natural alphabetical order (doc2.pdf before doc10.pdf)
pdfm ./documents -o alpha.pdf --sort natural
# Use defaults (generates merged.pdf, no sorting)
pdfm a.pdf b.pdf
Options
| Option | Description |
|---|---|
inputs |
PDF files or folders containing PDFs (required) |
-o, --output |
Output PDF path (default: merged.pdf) |
--sort |
Sort mode: none, name, natural, mtime, ctime |
--reverse |
Reverses the selected sort order |
Sort modes
none: No sorting (preserves the order files are passed in)name: Alphabetical by name (case-insensitive)natural: Natural order (file2.pdfbeforefile10.pdf)mtime: By modification date (oldest first)ctime: By creation date (oldest first)
When a folder is passed as input, the default sort is
natural. When individual files are passed, the default sort isnone.
Advanced examples
# Combine multiple folders and files
pdfm ./chapters ./images cover.pdf -o book.pdf --sort natural
# Sort by inverse creation date (newest first)
pdfm ./backup -o recent.pdf --sort ctime --reverse
# Merge without modifying input order
pdfm cap1.pdf cap3.pdf cap2.pdf -o manual.pdf --sort none
Requirements
- Python >= 3.10
- pypdf >= 5.0.0
- typer >= 0.12.0
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=pdf_joiner --cov-report=term-missing
License
Author
Mariano Soto — soymarianosoto@proton.me
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pdf_joiner-0.1.0.tar.gz
(7.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdf_joiner-0.1.0.tar.gz.
File metadata
- Download URL: pdf_joiner-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dd0029a759eb49c4c5fbf5081245ded44bd545f0a9e266efb7b3077318bf6c4
|
|
| MD5 |
d2f7a8b88fb2998c501b97549597a7d2
|
|
| BLAKE2b-256 |
522928b59580f282771539fc28a1f18a74f6500f1859723fcf324fccebddbb54
|
File details
Details for the file pdf_joiner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pdf_joiner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7e347da33cf7eaa144e58fabbaf62d55c50413d5c4ce08284d6eafa6b2efa10
|
|
| MD5 |
53e3b344999a7b95b75a3cdba0e4d82e
|
|
| BLAKE2b-256 |
8334f6722d6422a714d7b536f12e763b97f0844a9d7e12916f5fc0103e6f1069
|