Skip to main content

scanprep – Prepare scanned PDF documents

Small utility to prepare scanned documents. Supports separating PDF files by separator pages and removing blank pages.

Scanprep can be used to prepare scanned documents for further processing with existing tools (like the great OCRmyPDF) or directly for archival. It allows splitting multiple documents that were scanned in a single batch into multiple files. In addition, it can also remove blank pages from the output (this is especially helpful if using a duplex scanner).

For document separation, separator pages need to be inserted between the different documents before scanning. These pages tell the program where to split. You can either use the included separator page or create your own. The separator page simply needs to have a barcode that encodes the text SCANPREP_SEP (you can use any barcode type supported by zbar).

Installation

Via Snap

You can install scanprep from the Snap Store:

snap install scanprep

scanprep -h

Via PyPI

You can install scanprep using pip (consider doing that in a venv):

pip3 install scanprep

# If you see an error like "ImportError: Unable to find zbar shared library", you need to install zbar yourself. See: https://pypi.org/project/pyzbar/
scanprep -h

From source

To install scanprep from source, clone this repository and install the dependencies:

git clone https://github.com/baltpeter/scanprep.git
cd scanprep
pip3 install -r requirements.txt # You may want to do this in a venv.
# You may also need to install the zbar shared library. See: https://pypi.org/project/pyzbar/

python3 scanprep/scanprep.py -h

Usage

Most simply, you can run scanprep via scanprep <filename.pdf>. This will process the input file and output the results into your current working directory. To specify a different output directory, use scanprep <filename.pdf> <output_directory>.
The output files will be called 0-<filename.pdf>, 1-<filename.pdf>, and so on.

By default, both page separation and blank page removal will be performed. To turn them off, use --no-page-separation or --no-blank-removal, respectively.

Use scanprep -h to show the help:

usage: scanprep [-h] [--page-separation] [--blank-removal] input_pdf [output_dir]

positional arguments:
  input_pdf             The PDF document to process.
  output_dir            The directory where the output documents will be saved. (defaults to the
                        current directory)

optional arguments:
  -h, --help            show this help message and exit
  --page-separation, --no-page-separation
                        Do (or do not) split document into separate files by the included
                        separator pages. (default yes)
  --blank-removal, --no-blank-removal
                        Do (or do not) remove empty pages from the output. (default yes)

License

Scanprep is licensed under the MIT license, see the LICENSE file for details. Issues and pull requests are welcome!

Metadata

Release files for scanprep 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scanprep 1.0.2
File Size Uploaded
scanprep-1.0.2.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scanprep 1.0.2
File Interpreter ABI Platform
scanprep-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / scanprep-1.0.2.tar.gz

Download URL scanprep-1.0.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f1e492380d6979d74abc5ea509891f635daa5cb36b12d5699b62b525f1c7d547
BLAKE2b-256 checksum
How to use checksums
b68e1a198c72f2f122a10d5744b98b2704a9888441b50e526ef78c16123ba897
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

Release files / scanprep-1.0.2-py3-none-any.whl

Download URL scanprep-1.0.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47fe24b372a13d74045ea2b2ff34681552fe7f3540f3fab3bd70d7b5bb023699
BLAKE2b-256 checksum
How to use checksums
1730c404e3b60c883019022b6538ed8ee09be8cb7b7680b062a0e765dc8155f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page