Read text with OCR
Read the text of a scanned PDF (pages that are pictures, with no text layer) with Tesseract OCR, from every page or chosen pages, optionally keeping only the text between two markers.
Command in the PDF toolkit · id ooa.pdf/read_text_ocr · 9 inputs (1 required), 2 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Path | File | Yes | PDF file. | |
| Password | Credential | No | Password for protected PDFs. | |
| Pages | String | No | Pages to read, e.g. 1,3,5-7; every page when empty. | |
| Language | String | No | eng | Tesseract language(s), e.g. eng, deu or eng+fra. |
| Page mode | Number | No | 3 | Page layout mode: 3 automatic, 6 single block, 7 single line, 11 sparse text. |
| Resolution (DPI) | Number | No | 300 | Resolution the pages are rendered at for OCR; 300 suits most scans. |
| After text | String | No | Keep only the text after the first occurrence of this marker, e.g. Invoice number:. | |
| Before text | String | No | Keep only the text before this marker (searched after the after_text marker). | |
| Trim | Boolean | No | true | Remove spaces and line breaks at the start and end of the result. |
Outputs
| Output | Type | What it is |
|---|---|---|
| text | String | Recognised text of the pages, in page order. |
| pages | List | Recognised text of each page read, in page order. |