OCRmyPDF
$ ocrmypdf Official Low RiskOCRmyPDF (ocrmypdf) uses Tesseract and Ghostscript/qpdf to add an invisible, searchable text layer to scanned PDFs while preserving image quality and optionally producing PDF/A archival files. It offers deterministic exit codes, --deskew, --sidecar plain-text extraction, and -q/--quiet for clean scripted pipelines.
brew install ocrmypdf ocrmypdf orchestrates local Tesseract, Ghostscript, and qpdf binaries directly over multi-page PDF files on disk.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Fully non-interactive with --quiet, --sidecar text extraction, and documented numeric exit codes, though it has no --json output.
--quiet,--sidecar, and--output-type nonesupport clean scripting- No
--jsonoutput formatting
100% offline local processing with zero network access, explicit input/output file separation, and --skip-text safety against altering digital text.
- Zero network calls; explicit
input.pdf output.pdfseparation - Deterministic exit codes for CI error handling
Available via brew install ocrmypdf (bundling Tesseract, Ghostscript, qpdf) on macOS/Linux as well as PyPI and Linux distro packages.
- One-command
brew install ocrmypdfincludes native Tesseract/Ghostscript deps
Gold standard for searchable PDF/A generation, multi-core page parallelism (--jobs), deskewing, and sidecar text extraction.
- Handles
--deskew,--rotate-pages,--sidecar, and PDF/A output
Long-running, mature official repository (ocrmypdf/OCRmyPDF) under MPL-2.0.
- Official
ocrmypdf/OCRmyPDFrepo under MPL-2.0
Thorough ReadTheDocs manual including cookbook recipes and exit-code table.
- Comprehensive ReadTheDocs manual and exit-code docs
Security, Auth & Guardrails
Runs 100% locally offline with zero credentials or API keys.
MPL-2.0 open-source CLI; completely free locally (note that bundled Ghostscript dependency is AGPLv3).
# OCRmyPDF CLI (ocrmypdf) Agent Rules - Always write to a new output path (`ocrmypdf in.pdf out.pdf`) rather than overwriting `in.pdf` in place. - Combine `--deskew` with `--skip-text` so PDFs that already contain text layers do not fail. - Pass `-q` / `--quiet` in automated scripts to suppress progress bars.
Agent-Ready Command Recipes
Safe Read-Only Queries
ocrmypdf --output-type none --sidecar extracted.txt --quiet scanned.pdf -
Runs OCR and writes only the extracted plain text to extracted.txt without creating an output PDF.
Controlled Writes & Previews
ocrmypdf --deskew --skip-text --quiet scanned.pdf searchable.pdf
Straightens tilted scans, skips pages that already have text (--skip-text), and writes searchable.pdf.
Strengths for Agents
- + One-command
brew install ocrmypdfhandles Tesseract and Ghostscript dependencies cleanly. - + Deterministic exit codes,
--skip-text, and--sidecarmake batch PDF pipelines reliable.
Caveats & Pitfalls
- ! Outputs PDFs and plain-text
--sidecarfiles rather than--json. - ! Passing
--deskewon a PDF with an existing text layer fails unless--skip-textor--force-ocris also provided.