Skip to main content

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​

InputTypeRequiredDefaultWhat it is
PathFileYesPDF file.
PasswordCredentialNoPassword for protected PDFs.
PagesStringNoPages to read, e.g. 1,3,5-7; every page when empty.
LanguageStringNoengTesseract language(s), e.g. eng, deu or eng+fra.
Page modeNumberNo3Page layout mode: 3 automatic, 6 single block, 7 single line, 11 sparse text.
Resolution (DPI)NumberNo300Resolution the pages are rendered at for OCR; 300 suits most scans.
After textStringNoKeep only the text after the first occurrence of this marker, e.g. Invoice number:.
Before textStringNoKeep only the text before this marker (searched after the after_text marker).
TrimBooleanNotrueRemove spaces and line breaks at the start and end of the result.

Outputs​

OutputTypeWhat it is
textStringRecognised text of the pages, in page order.
pagesListRecognised text of each page read, in page order.