https://github.com/dbrgn/pydigitize
Command line tool to easily scan documents into OCRd PDF/A files for archival.
https://github.com/dbrgn/pydigitize
Last synced: 10 months ago
JSON representation
Command line tool to easily scan documents into OCRd PDF/A files for archival.
- Host: GitHub
- URL: https://github.com/dbrgn/pydigitize
- Owner: dbrgn
- License: apache-2.0
- Created: 2017-07-11T19:26:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-14T16:55:36.000Z (over 3 years ago)
- Last Synced: 2025-01-12T10:42:22.665Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 71.3 KB
- Stars: 61
- Watchers: 4
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# pydigitize

## Features
pydigitize is a simple command-line based tool to scan/archive documents.
It does the following steps:
- Scan a document with any scanner that supports SANE (ADF supported)
- Straightening and cleaning of scanned documents
- Run OCR on PDF so that it becomes searchable
- Generate [PDF/A](https://en.wikipedia.org/wiki/PDF/a) file for archival
- Add keywords to the PDF file
Because you don't want to type the same arguments for every piece of paper that
you scan, pydigitize supports profiles: A profile pre-configures settings like
the output directory, the resolution, whether to run OCR, additional PDF
keywords, etc. You can create a profile for all your invoices for example. Then
every time you get an invoice, you scan it with `./scan.py -p invoice`, done.
## Requirements
- Python 3.x
- OCRmyPDF
- libtiff
- sane
- unpaper
- ghostscript
## Usage
See `./scan.py --help`.
## Profiles
If you want to use profiles, create a `profiles.toml` file in the current
directory.
For every profile you can specify the following parameters:
- `path`: The output directory
- `name`: Set a string that will be included in every filename in slugified form
- `ocr`: Whether to run OCR, straightening and cleanup on the scanned document
- `keywords`: List of keywords that will be added to PDF Metadata
You can also create sub-profiles. They inherit the settings from the parent.
Example:
```toml
[bill]
path = "/home/user/bills/"
name = "bill"
ocr = true
keywords = ["bill"]
[bill.dentist]
name = "dentist"
keywords = ["bill", "dentist"]
[drawing]
path = "/home/user/drawings/"
ocr = false
```
Then pass the name of the profile to the `scan.py` command using the `-p`
parameter.
./scan.py -p bill.dentist
You can of course override your parameters:
./scan.py -p bill -n amazon
## Interactive (Batch) Scanning
If you want to scan a specific number of pages, use the `-c` argument.
pydigitize will prompt you to confirm before scanning every page. This is very
useful for example when scanning double-sided documents on a scanner that does
not have a duplex unit, or when scanning a document partially in the ADF and
partially on the flatbed.
If you don't want manual confirmation, but just want the scanner to scan as
fast as it can, use the `--nowait` argument.
## License
Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT) at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.