Skip to content

Python3 service to detect (via Linux's inotify) to create searchable PDFs with Tesseract

License

Notifications You must be signed in to change notification settings

seanrees/auto-tesseract

Repository files navigation

build and tests

auto-tesseract

What

This is a Python3 service to detect (via Linux's inotify()) new PDFs in --in_dir, and automatically rewrite them as searchable PDFs in --out_dir. This is particularly useful if, for example, you have a scanner that outputs PDFs onto a fileserver (as we do :-)).

This program uses Tesseract OCR's to produce the text. This program also uses ImageMagick to convert the original PDF to TIFF format, for use by Tesseract. In both cases, the program relies on the command-line tools from these packages.

This package also depends on Linux's inotify() system call.

Usage

This program has two main arguments: --in_dir and --out_dir. Any PDF copied or moved into --in_dir will automatically trigger the process, and a searchable version of the PDF will appear shortly in --out_dir. The original is untouched.

% ./main.py --in_dir=input --out_dir=output

This program will also backfill missing work. If there are files in the input directory that do not exist in the output directory, auto-tesseract will automatically OCR them immediately upon startup.

Build

This program is built with Bazel.

To build the main package:

% bazel build :main

To build a Debian package:

% bazel build :main-deb

To run all the tests:

% bazel test ...

About

Python3 service to detect (via Linux's inotify) to create searchable PDFs with Tesseract

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published