---
name: "pdf123-ocr-text"
description: "Read a scanned PDF in the language you choose and download the text as a .txt file. Runs the PDF123 \"OCR PDF to Text\" tool (pdf123.xyz) over its REST API with curl, no account needed. Use when the user wants this done to their file. Also known as: OCR PDF 转文本, OCR de PDF a texto, OCR से PDF को टेक्स्ट में, OCR من PDF إلى نص, OCR de PDF para texto, OCR PDF ke Teks, OCR de PDF en texte, OCR PDF в текст, OCRでPDFをテキストに, OCR: PDF in Text, OCR로 PDF를 텍스트로, OCR PDF sang văn bản, OCR ile PDF'den metne, OCR PDF 轉文字, OCR da PDF a testo, OCR PDF เป็นข้อความ, OCR: PDF na tekst, OCR PDF у текст, OCR: PDF naar tekst, OCR: PDF till text, OCR PDF σε κείμενο, OCR на PDF в текст, OCR de PDF a text, OCR ya PDF hadi Maandishi."
compatibility: "Needs curl 7.76+ and outbound HTTPS to pdf123.xyz, or PDFX_API_BASE pointing at a self-hosted pdfx-server."
---

# OCR PDF to Text (PDF123)

Read a scanned PDF in the language you choose and download the text as a .txt file.

Web version: https://pdf123.xyz/ocr-pdf-to-text · All tools: https://pdf123.xyz/skills/pdf123.md

## When to use

- Pulling the words out of a scanned letter, report or ID document
- Feeding scanned pages to a search index or an AI workflow as text
- Copying a few paragraphs from a photographed page without retyping

## Run it

Replace the sample file names and values with the user's, then run:

```bash
API="${PDFX_API_BASE:-https://pdf123.xyz}"
curl -sS --fail-with-body -X POST "$API/api/v1/misc/ocr-text" \
  -F "fileInput=@input.pdf" \
  -F "languages=eng" \
  -F "ocrType=Normal" \
  -F "pageMarkers=false" \
  -F "pageNumbers=all" \
  --output-dir "pdf123-output/$(date +%Y%m%d-%H%M%S)" --create-dirs -OJ -w '%{filename_effective} %{content_type}\n'
```

## Inputs

Everything is `multipart/form-data`. The command above already sends each field with its default; keep them all and change only the values the user asked for, since some endpoints reject a missing optional field.

| Field | Type | Required | Default | Notes |
| --- | --- | --- | --- | --- |
| `fileInput` | file | yes | | .pdf (one file) |
| `languages` | text | no | `eng` | Document languages |
| `ocrType` | choice | no | `Normal` | OCR mode. One of: `Normal` (Normal (scanned pages only)), `force-ocr` (Force OCR (re-OCR every page)) |
| `pageMarkers` | choice | no | `false` | Page headings. One of: `false` (No page headings), `true` (Add a heading before each page) |
| `pageNumbers` | text | no | `all` | Pages to recognize. 1-based page list: `1,3-5`, open range `7-`, `all`, or an `n` expression such as `2n` for even pages |

## Result

curl saves the result in a new `pdf123-output/<timestamp>/` directory under the server's file name and prints its path and content type. Several output files come back as one ZIP. Tell the user where the file is.

## Limits

- At most 50 pages that need OCR per request on this site; self-hosted servers can change it
- Columns, tables and reading order are not reconstructed
- Accuracy depends on scan quality and on picking the right languages
- Upload limit on this website: 500 MB per file, sent in chunks above about 95 MB. A single direct API request body is capped at 100 MB.

## Errors

- A non-zero curl exit means the request failed. The saved file then holds `application/problem+json`; read it and report its `detail` to the user instead of retrying blindly.
- `413`: the upload exceeds 100 MiB. `429`: wait for `Retry-After` seconds, then retry once.
- Send `X-API-KEY: $PDFX_API_KEY` only if the user has a PDF123 API key; anonymous calls work without it.

## Privacy

Files are uploaded to the API host, processed, and deleted once the response is sent. For confidential files, ask before uploading, or use a self-hosted server via `PDFX_API_BASE`.
