Books

OPDS catalog for ebook readers

OCR pipeline guide

Turn a scanned PDF or DjVu into an ebook with searchable text, illustrations, and page references.

  1. Install the tools

    Use Python 3.12 and Tesseract with Ukrainian language data. The setup guide covers DjVu support, GPU OCR, local model review, and format validators.

    Read the installation guide
  2. Build an ebook from a scan

    Replace the scan path, title, and author with the details for your book. Run these commands from the repository with the virtual environment active.

    python -m preservation init jobs/example "scan.pdf" --title "Book title" --author "Author" --language uk --facsimile
    python -m preservation run jobs/example

    Find the files in jobs/example/output/. The facsimile EPUB includes the scanned pages and an OCR text layer.

  3. Check the illustrations and text

    The pipeline crops detected figures and reads the text beneath them. Check page order, captions, and missed illustrations. Compare ambiguous letters such as Ї, І, I, and T against the print, and keep historical spellings.

    python -m preservation suggest jobs/example
    python -m preservation approve jobs/example CORRECTION_ID
    python -m preservation build jobs/example
  4. Validate before sharing

    Use EPUBCheck and the FictionBook schema for strict validation. Open the ebook in a reader to check its contents, captions, footnotes, and illustrations. Credit the source scan and check its terms before sharing an edition.

    python -m preservation validate jobs/example --strict
Pipeline reference