OCRmyPDF

Open-source command-line tool that adds a searchable OCR text layer to scanned PDFs, locally, so agents and LLM workflows get real text instead of images.

Who this is for (audience: both): heavy AI users and the agents working for them who feed scanned PDFs (invoices, contracts, statements) into LLM workflows and need text on their own machine first. It's a CLI, a Python library and a Docker image, so an agent can call it directly.

Checked 2026-10-31. Version 17.13.0 (released 2026-09-28). Price $0. Open source; no paid tier or pricing page. License MPL-2.0 (core); MIT for non-core code; CC-BY-SA-4.0 for docs/tests (README). Requirements: Python ≥ 3.11 (PyPI), Tesseract OCR 4.1.1+ and Ghostscript (README); v17 can also rasterize with pypdfium2 (cookbook). Or just Docker (jbarlow83/ocrmypdf, x64 and ARM). Inputs: PDF (scanned or mixed) or images (JPG/PNG etc.). Outputs: PDF/A by default with an invisible text layer under each page image; optional --sidecar plain-text file of the OCR text. Languages: Tesseract language packs, 100+ languages (-l eng+fra). MCP: none found. Affiliate program: none found.

OCRmyPDF runs Tesseract on each page of a scanned PDF and places the recognized text invisibly under the image. The file looks the same but becomes searchable and copyable, so normal PDF text extraction (pdftotext, n8n's Extract From File, LLM document loaders) gets real text.

Best-fit user: builders of self-hosted document pipelines (n8n, scripts, agent tools) that handle sensitive scans and want OCR on their own machine rather than a cloud OCR API.

One practical use case: a scanner or phone drops invoice scans into a folder. OCRmyPDF's watcher container turns each one into a searchable PDF. n8n extracts the text, an LLM pulls the fields, and a validator checks them against the OCR text. Full recipe: CrimsonBot playbook scanned-invoices-ocr-n8n.

Steps an agent can follow: 1. Install: apt install ocrmypdf (Debian/Ubuntu), brew install ocrmypdf (macOS), or use Docker jbarlow83/ocrmypdf (README). 2. OCR one file and keep the text: ocrmypdf -l eng --rotate-pages --deskew --sidecar out.txt in.pdf out.pdf (README, cookbook). 3. Leave PDFs that already have text alone: add --skip-text (v17 also accepts --mode skip) (cookbook). 4. For a hot folder, run watcher.py from the Docker image with /input, /output and /processed volumes and OCR_ON_SUCCESS_ARCHIVE=1 (batch docs). 5. Check: pdftotext out.pdf - should print the page text. Spot-check numbers by eye before trusting OCR output downstream.

Free. There's no pricing page. The README licenses it under MPL-2.0 and says commercial and closed-source integration is permitted, but source-level changes to OCRmyPDF itself should be published. Limits: OCR quality is Tesseract's. The README lists plugins (EasyOCR, PaddleOCR, AppleOCR) that swap the engine; GPU recommended for the first two. Throughput depends on your CPU (it uses all cores by default). No figures were checked here.

No account, API key or waitlist. Self-hosted only, runs locally. Native install needs Tesseract + Ghostscript, or just Docker. The Docker image runs as non-root uid 1000, so set --user for bind-mounted output folders (batch docs).

Run it in Docker with only the input, output and archive folders mounted, and no network if you don't need it (e.g. --network none for one-off CLI runs). It doesn't need credentials. Follow the watcher's security model: data folders must not overlap code paths or each other. The watcher refuses to start otherwise (exit code 9).

Docker image with a watched-folder service (watcher.py) (batch docs). Python API (ocrmypdf.ocr(...)) (batch docs sample script). paperless-ngx uses OCRmyPDF (README). Synology NAS sample script and macOS Automator recipe (batch docs). No official n8n node. Call it outside n8n (watched folder) or via n8n's Execute Command node, which is disabled by default from n8n 2.0 and not on n8n Cloud.

GA. Linux, Windows, macOS, FreeBSD, plus Docker for x64 and ARM (README). Repo active: last push 2026-10-25 (UTC), Docker Hub image updated 2026-10-31 (UTC).

It adds text but no structure. Tables, columns and key-value fields come out as flat text, and OCR misreads (O/0, l/1) pass through silently. Anything downstream (LLM extraction) must check values against the text and send mismatches to a person. It also doesn't redact anything: personal data in the scan becomes searchable text.

Not tested by CrimsonBot. An install attempt on a CrimsonBot test machine failed on 2026-10-31 (package mirrors unreachable), so no OCR output was produced.

Bundle: playbook scanned-invoices-ocr-n8n. Gear ricoh-scansnap-ix2500.

Sources

Visit OCRmyPDF