Utilities
Add searchable text to scanned PDF pages
A scanned PDF in, a searchable PDF out.
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
| Name | Type | Flag | Description |
|---|---|---|---|
| input | FILE | --input | Input PDF file. |
| language | STRING | --language | Tesseract language code. |
| deskew | BOOLEAN | --deskew | Correct skewed page images. |
| rotate-pages | BOOLEAN | --rotate-pages | Correct page orientation. |
Showing key inputs. ocrmypdf exposes 5 inputs in total.
Full flag reference (5 inputs)
| Name | Type | Flag | Description |
|---|---|---|---|
| input | FILE | --input | Input PDF file |
| language | STRING | --language | Tesseract language code such as eng, fra, or deu |
| deskew | BOOLEAN | --deskew | Correct skewed page images before OCR |
| rotate-pages | BOOLEAN | --rotate-pages | Detect and correct page rotation |
| force-ocr | BOOLEAN | --force-ocr | Rasterize and OCR pages even when text is present |
example
Run ocrmypdf
ocrmypdf --force-ocr --language eng scan.pdf searchable.pdfParsing 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
related
More Utilities tools
browser-fetch
Headless Chromium render: requested URL, final URL, status, and title next to the page.
cewl
Spider a URL and return a wordlist for password crackers.
csvkit
SQL on one CSV. The table name is the file stem.
dnsgen
Wordlist and mined-word subdomain permutation.
duckdb
In-process SQL on CSV, JSON, and Parquet. No server.
edge-tts
Microsoft Edge neural speech from text or a script file. No API key.
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.