ocr_pdf
Make scanned PDFs searchable by adding an invisible Tesseract OCR text layer to a copy, so text can be searched, selected, and copied without changing page appearance.
Instructions
Make a scanned PDF searchable: write a copy (default "_ocr.pdf") whose pages carry an invisible text layer recognised by Tesseract OCR, so text can be searched, selected and copied (search_text, extract_text and redact_pdf's texts then work on it). The pages look exactly as before: pictures are not re-rendered or re-compressed. Needs the tesseract command installed.
language: Tesseract language codes joined by +, e.g. "eng" (default), "deu", "eng+fra"; only installed languages work. pages: a page spec (default all). skip_pages_with_text (default true) leaves pages that already have text (including an earlier OCR layer) alone, listed in pages_with_text; false reads them too, which can duplicate their text. dpi 150-600 (default 300, best for most scans; very large pages are read at less). Each page reports its words and Tesseract's mean confidence (0-100; below about 70, expect misread words: check with view_pages). Pages are read upright as displayed; text printed sideways on a page isn't found. Pages with very large content (over 16 MB or 500,000 tokens) are refused. Needs the owner password if the PDF forbids copying. Signed PDFs are refused. At most 10 minutes per call, including waiting while other calls use Tesseract (4 pages at a time in all): OCR a long document in parts with pages.
Any password argument can be "ask": the user then types it on a local page, so it never passes through the chat.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"input_path": "<input_path>"
},
"name": "ocr_pdf"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dpi | No | ||
| pages | No | ||
| language | No | eng | |
| password | No | ||
| overwrite | No | ||
| input_path | Yes | ||
| output_path | No | ||
| skip_pages_with_text | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pages | Yes | ||
| words | Yes | ||
| output | Yes | ||
| language | Yes | ||
| pages_with_text | Yes | ||
| password_protected | Yes | ||
| user_password_changed | Yes | ||
| permissions_restricted | Yes |