PDF to text
pdf_to_textExtract text from PDFs with paragraphs and right-to-left lines rebuilt as plain text or Markdown, including page ranges and passwords; flags scanned pages without a text layer (no OCR).
Instructions
Extract the text of a PDF with lines and paragraphs rebuilt (right-to-left Arabic/Hebrew lines in reading order), as plain text or Markdown, with optional page separators and reflow (join lines, mend hyphenated words). Returns per-page word counts and flags pages with no text layer (scans: this tool does no OCR). Supports page ranges and passwords. Give "output" to write a .txt/.md file instead of returning the text inline. Web version: https://s3eidat.github.io/pdf-to-text/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | The PDF: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI). | |
| pages | No | Pages to read: 1-based list like "1-3, 5, 8-" ("5-" = to the end, "-3" = first three, "3-1" = reversed). Also "all", "odd", "even", "last". Empty = all pages. | |
| format | No | "text" or "markdown" (## Page N headings, reflowed paragraphs). | text |
| output | No | Write the text to this file (or folder ending in "/") instead of returning it inline. | |
| reflow | No | Join the lines of each paragraph and mend words split by a hyphen. | |
| perPage | No | Also return each page's text separately. | |
| maxChars | No | Cut the inline text after this many characters (the file output is never cut). | |
| password | No | Password, if the PDF is protected. | |
| separators | No | Put a "——— Page N ———" line before each page. Default true. |