Text + OCR Fallback
AI-generatedSummary
Extract text from a PDF file using direct extraction with an automatic OCR fallback on pages containing no selectable text.
Inputs
- Pages — Select which pages of the PDF to extract text from; options are all pages or specific pages.
- Page Numbers — Comma-separated list of specific page numbers to extract text from, used if 'Specific Pages' is selected.
- OCR Languages — Languages to use for OCR if no selectable text is found on any page; multiple languages can be selected.
- Page Segmentation (OCR) — Set how Tesseract analyzes the page during OCR; auto is recommended and works for most documents.
- Text Output Format — Format of the extracted text; options include Plain Text, Markdown (with formatting), JSON (structured data), and HTML.
- Output Mode — Determines if text is outputted per page (one item per page) or combined into a single item with all pages' text.
- Page Separator — Separator string inserted between page texts when using the combined output mode.
- Additional Options — Optional settings including OCR DPI resolution (default 200), whether to include hOCR HTML output, include PDF metadata in the output, and output text only without metadata or statistics.
- Input Binary Property (required) — Name of the binary property containing the PDF file to extract text from.
Output shape
a list of JSON items representing extracted text per page or combined across pages, including page numbers, word and character counts, optional metadata, and OCR error information if applicable.
Returns one item per page with extracted text or a single combined item based on the Output Mode. The operation attempts direct text extraction first; if pages have no selectable text, it falls back to OCR for those pages. If direct extraction fails entirely, OCR is applied to all selected pages. OCR options are configurable. Output includes error messages per page if OCR fails. Output format respects the chosen Text Output Format, and when combined, pages are separated by the specified Page Separator.
Examples
Example 1: Extract text from all pages in plain text format, outputting one item per page, with OCR fallback enabled for pages without selectable text.
Pages = All Pages; Text Output Format = Plain Text; Output Mode = Per Page; OCR Languages = English and German; Input Binary Property = data
Example 2: Extract from specific pages (1,3,5), output combined text in Markdown, include PDF metadata, and enable hOCR output.
Pages = Specific Pages; Page Numbers = 1,3,5; Text Output Format = Markdown; Output Mode = Combined Text; Page Separator = "\n\n---\n\n"; Additional Options: Include Metadata = true; Include hOCR = true; Input Binary Property = data