Default template for PDM package
Project description
document-mover
A Python-based automated PDF merging and file movement workflow, particularly useful for scanning operations.
Features
PDF Merger (pdf-merger)
- Merge two PDFs with alternating page order (page1, page2, page3, page4, etc.)
- Delete source files after successful merge (optional)
- Remove empty pages from the merged PDF (optional)
- CLI interface for easy command-line usage
Consecutive PDF Merger (process_pdf_merge)
- Auto-detect consecutive PDFs based on filename numbering
- Merge pairs of consecutively numbered files automatically
- Process entire folders with batch operations
- Dry-run mode to preview operations before executing
Document Mover (document-mover)
- File stability checking - ensures files are fully written before processing
- Selective file movement - separate handling for regular and dual-sided files
- Dual-sided file pairing - automatically pairs and merges dual-sided scans
- Atomic operations - safe file movements with proper permission handling
- Comprehensive logging - detailed tracking of all operations
Installation
pdm install
Usage
PDF Merger
Merge two PDF files:
pdm run pdf-merger file1.pdf file2.pdf output.pdf
With options:
pdm run pdf-merger file1.pdf file2.pdf output.pdf --delete-source --remove-empty-pages --verbose
Options:
--delete-source: Delete source PDF files after successful merge--remove-empty-pages: Remove empty pages from the merged PDF--verbose: Enable verbose logging
Consecutive PDF Merger
Process a folder and merge consecutive PDFs:
pdm run process_pdf_merge /path/to/folder
With options:
pdm run process_pdf_merge /path/to/folder --dest-folder /path/to/dest --dry-run --verbose
Options:
--dest-folder: Directory for merged PDF output (defaults to source folder)--dry-run: Preview operations without executing--verbose: Enable verbose logging
Document Mover
Move processed documents:
pdm run document-mover /path/to/source --dest /path/to/dest
With options:
pdm run document-mover /path/to/source --dest /path/to/dest --dual-dest /path/to/dual-dest --stability-wait 5 --min-age 30 --verbose
Options:
--dest: Destination folder for regular files (required)--dual-dest: Destination folder for dual-sided files--stability-wait: Seconds to wait before checking file stability (default: 2)--min-age: Minimum file age in seconds before processing (default: 60)--verbose: Enable verbose logging
Configuration
Ruff Formatting
The project is configured to use ruff with a line length of 120 characters. This is set in pyproject.toml:
[tool.ruff]
line-length = 120
The VS Code editor is also configured to display a ruler at column 120 for consistency.
Project Structure
document-mover/
├── src/
│ └── document_mover/
│ ├── __init__.py
│ ├── pdf_merger.py # PDF merging utilities
│ ├── document_mover.py # Main file movement system
│ └── file_lock.py # File locking utilities
├── tests/
│ └── __init__.py
├── pyproject.toml # Project configuration & dependencies
└── README.md
Requirements
- Python 3.13+
- pypdf >= 6.4.1
- ruff >= 0.14.8
- mypy >= 1.19.0
Development
Running Tests
pdm run pytest
Code Quality
Format code with ruff:
pdm run ruff format .
Type checking with mypy:
pdm run mypy src/
Use Cases
Scanning Workflow
- Scan dual-sided documents as separate files (page 1, page 2, etc.)
- Run document-mover to automatically pair and merge dual-sided files
- Process results to final destination with proper organization
PDF Organization
- Use consecutive PDF merger to automatically merge numbered PDF sets
- Delete source files after successful merge to save space
- Remove empty pages for cleaner final documents
License
MIT
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
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 document_mover-0.1.0.tar.gz.
File metadata
- Download URL: document_mover-0.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.26.2 CPython/3.13.2 Linux/6.18.1-1-cachyos-bore
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6f90684015c7ea639ba8ef3c83fa884384459c44598b1afce7dc50dc14fd62a
|
|
| MD5 |
d4012ac3d47e01369be8e2d4ad4af548
|
|
| BLAKE2b-256 |
cc15dfd0c80d006761dac5c2cf905c43c9e2e8d26e02447abbe2a06000dc8481
|
File details
Details for the file document_mover-0.1.0-py3-none-any.whl.
File metadata
- Download URL: document_mover-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.26.2 CPython/3.13.2 Linux/6.18.1-1-cachyos-bore
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fd7d8e58bc8572862bbf7de4faf6041bba21fb0480f08492bfa187befe600e9
|
|
| MD5 |
bc2aea5efd2996d17046dc30c717f74a
|
|
| BLAKE2b-256 |
8660e314d12a09a5b82a83a108ddd97ec2df3acc0ea6a3148b8f99471b38b60b
|