Updated Sep 21, 2026

Utilities

Add searchable text to scanned PDF pages

A scanned PDF in, a searchable PDF out.

Agent

overview

What ocrmypdf does

OCRmyPDF rasterizes or inspects connected PDF pages, runs Tesseract where OCR is needed, and writes a separate PDF with a searchable text layer. The original page appearance is retained while recognized text becomes selectable.

Set --language to the appropriate Tesseract language. --deskew corrects tilted scans, --rotate-pages corrects page orientation, and --force-ocr rebuilds pages that already contain text.

The result remains a PDF rather than plain extracted text. Use pdftotext after this node when downstream steps need text content instead of a searchable document.

source github.com/ocrmypdf/OCRmyPDF

use cases

Where ocrmypdf fits

Index scanned records

Make image-only PDF pages searchable before indexing or document review.

Repair mixed PDFs

Force OCR on documents that contain unreliable text layers alongside scanned pages.

Prepare text extraction

Create a searchable intermediate PDF before passing it to pdftotext.

reference

ocrmypdf inputs and flags

5 inputs
NameTypeFlagDescription
inputFILE--inputInput PDF file.
languageSTRING--languageTesseract language code.
deskewBOOLEAN--deskewCorrect skewed page images.
rotate-pagesBOOLEAN--rotate-pagesCorrect page orientation.

Showing key inputs. ocrmypdf exposes 5 inputs in total.

Full flag reference (5 inputs)
NameTypeFlagDescription
inputFILE--inputInput PDF file
languageSTRING--languageTesseract language code such as eng, fra, or deu
deskewBOOLEAN--deskewCorrect skewed page images before OCR
rotate-pagesBOOLEAN--rotate-pagesDetect and correct page rotation
force-ocrBOOLEAN--force-ocrRasterize and OCR pages even when text is present

example

Run ocrmypdf

ocrmypdf · command
ocrmypdf --force-ocr --language eng scan.pdf searchable.pdf
sample output
Parsing 1 pages with HocrParserOutput file is a PDF (auto mode)

guidance

Choosing ocrmypdf

Use OCRmyPDF when the deliverable must remain a searchable PDF. Use Tesseract for direct image-to-text OCR.

tesseract

Recognizes text directly from image files.

pdftotext

Extracts an existing PDF text layer as plain text.

qpdf

Repairs and transforms PDF structure without OCR.

faq

ocrmypdf questions

It preserves the visible page while adding recognized text and may optimize the PDF representation.

Run ocrmypdf yourself

A one-page PDF fixture is forced through OCR and the resulting artifact is validated as a readable PDF with recognized text.

Facts on this page come from the live Trickest tool library.