Scan PDF Cleaner CLI
A high-speed CLI utility and Python library to automatically detect and delete blank pages from scanned PDFs, remove whitespace borders, and clean multi-page document batches.
An online browser-based version is available at TheFreeConverter PDF Tools.
Features
- Blank-Page Detection: Evaluates ink density and page bitmap intensity to accurately remove blank scan backs and separator pages.
- Margin Auto-Cropping: Automatically trims outer scanner borders and non-printable margins.
- Batch Processing: Clean entire folders of digitized contracts, scans, or receipts quickly.
- Local Execution: Runs entirely on your local machine without third-party network requests.
Installation
pip install scan-pdf-cleaner-cli
Or install from source:
git clone https://github.com/The-Free-Converter/scan-pdf-cleaner.git
cd scan-pdf-cleaner
pip install -r requirements.txt
pip install -e .
Quickstart & CLI Usage
1. Remove blank pages from a PDF
scan-pdf-cleaner scanned_document.pdf
# Outputs: scanned_document_cleaned.pdf
2. Remove blank pages AND crop margins
scan-pdf-cleaner document.pdf --crop -o ./clean_doc.pdf
3. Adjust blank-page sensitivity threshold
# Higher threshold (e.g. 1.0) considers pages with light scanner noise as blank
scan-pdf-cleaner document.pdf --threshold 1.0
Python API Usage
from scan_pdf_cleaner import remove_blank_pages, crop_pdf_margins
# Remove blank pages
retained, removed = remove_blank_pages("scanned_batch.pdf", "output_cleaned.pdf")
print(f"Kept {retained} pages; discarded {removed} blank pages.")
# Crop margins
crop_pdf_margins("output_cleaned.pdf", "final_cropped.pdf", margin_pt=36.0)
Online Web Tools
Browser-based PDF processing tools:
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 scan_pdf_cleaner_cli-1.0.0.tar.gz.
File metadata
- Download URL: scan_pdf_cleaner_cli-1.0.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49c24635ed66527e3534214f7c7824da75240c542eb070bcf617f0e1e81d78e0
|
|
| MD5 |
c6d67cf16f7683f7f6cc9f3e1e865937
|
|
| BLAKE2b-256 |
2ca4971b2706023db96aa4811e4b2f32639294d8c03a6a458587b321b37b412c
|
File details
Details for the file scan_pdf_cleaner_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: scan_pdf_cleaner_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5febf48b26a23f2f37893dac8b31c6203d3610a857a2aca2e860a5ad7fe7ab11
|
|
| MD5 |
f1abbca69f1594a1cbddb7c20e521751
|
|
| BLAKE2b-256 |
1bc2fa31dd089408c5cb6961839346228407db8a91a87386451870fdcc88e89e
|