Remove watermarks from PDF files, supporting both image-based and text-based watermarks. Provides a command-line interface (CLI) and a web service for batch and remote processing.
| Feature | Description |
|---|---|
| Automatic Detection & Removal | Detects and removes watermarks automatically |
| Image & Text Watermark Support | Handles both image and text watermarks |
| CLI & Web Service | Command-line and web UI for flexible usage |
| Batch & Recursive Processing | Batch process directories, with optional recursion |
| Parallel Processing | Accelerate with multi-process parallelism |
| Environment Variable Config | Flexible configuration via environment variables |
| Progress Reporting | Detailed progress output |
| Logging & Log Rotation | Console/file logging with rotation and filtering |
| Robust Error Handling | Custom exceptions for various error scenarios |
| Unit Tests | Comprehensive unit tests |
# Clone repository
git clone https://github.com/yourusername/pdf-watermark-remove.git
cd pdf-watermark-remove
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtBasic usage:
python cli.py /path/to/your/document.pdfThis creates an output file named document_no_watermark.pdf in the same directory.
python cli.py document.pdf --out output.pdfStart the server:
python server.pyVisit http://localhost:5566 in your browser to upload PDF files for watermark removal.
- Job Status: After upload, the web UI shows job progress and any errors encountered.
- Unified Logic: The server now uses the exact same watermark removal logic as the CLI (via
remove_watermarkinremove_watermark.py). There is no code duplication; all PDF processing is consistent across both interfaces.
| Variable | Description | Default |
|---|---|---|
| PDF_WATERMARK_LOG_LEVEL | Logging level | INFO |
| PDF_WATERMARK_LOG_FILE | Log file path | (none) |
| PDF_WATERMARK_MAX_CONCURRENT_PAGES | Max concurrent page processing | 8 |
| PDF_WATERMARK_TEMP_DIR | Temp file directory | data |
| PDF_WATERMARK_SERVER_HOST | Server host | 0.0.0.0 |
| PDF_WATERMARK_SERVER_PORT | Server port | 5566 |
| PDF_WATERMARK_PARALLEL_PROCESSES | Default parallel worker count | 1 |
| File/Class | Purpose |
|---|---|
remove_watermark.py |
Core watermark removal logic (shared by CLI/server) |
strategies.py |
Watermark removal strategies |
config.py |
Configuration management (env var support) |
exceptions.py |
Custom exceptions |
cli.py |
Command-line interface |
server.py |
Web service interface |
logging_utils.py |
Logging utilities |
tests.py |
Unit tests |
MIT