# OCR Text Extractor (`lergassy/ocr-text-extractor`) Actor

Read text off images and scanned PDFs with OCR in 19 languages. Every page returns its recognised text and an engine confidence score, plus optional word positions for building document parsers. Export data, run via API, schedule runs, or integrate with other tools or AI workflows.

- **URL**: https://apify.com/lergassy/ocr-text-extractor.md
- **Developed by:** [Matvey](https://apify.com/lergassy) (community)
- **Categories:** Developer tools, AI, Agents
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 file processeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

Read text off **images and scanned PDFs** with OCR in 19 languages. Every page comes back with the recognised text and an **engine confidence score**, and every word can come back with its position on the page. No API key, no external OCR service, no per-call quota.

### What is OCR Text Extractor?

OCR Text Extractor turns pictures of text into text you can search, index or feed to a model. Point it at PNG, JPG, WEBP, TIFF, BMP, GIF or HEIC files, or at a scanned PDF, and it returns the text page by page.

Two things make it different from a plain OCR wrapper. It tells you **how sure it is** — an average confidence per page and per word — so you can route doubtful scans to a human instead of trusting them silently. And it returns **word boxes**: the position of every recognised word, which is what you need to highlight text on the original image or to build a parser that reads fields by location.

| What you give it | What you get back |
| --- | --- |
| A photo or screenshot of text | Recognised text with a confidence score |
| A scanned PDF | Text page by page, only the scanned pages billed |
| A PDF that already has text | The existing text layer, copied for free |
| A batch of mixed files | One row per file, same fields for all of them |

### What data can OCR Text Extractor extract?

| Field | Type | Example |
| --- | --- | --- |
| `source` | string | `https://example.com/invoice.png` |
| `format` | string | `image` or `pdf` |
| `pageCount` | integer | `12` |
| `pagesRead` | integer | `12` |
| `ocrPageCount` | integer | `9` |
| `language` | string | `eng` |
| `text` | string | `INVOICE 2026-114\nMalina Data…` |
| `wordCount` | integer | `26` |
| `charCount` | integer | `184` |
| `confidence` | number | `93.7` |
| `pages` | array | `[{"number": 1, "text": "…", "confidence": 93.7, "source": "ocr"}]` |
| `words` | array | `[{"text": "INVOICE", "confidence": 95, "left": 124, "top": 168, "width": 174, "height": 32}]` |
| `status` / `errorCode` / `errorMessage` | string | `ok`, or why a file failed |
| `warnings` | array | `["Only the first 50 selected page(s) were processed."]` |
| `extractedAt` | string | `2026-09-05T09:14:02+00:00` |

Each page says whether its text came from OCR or from a text layer the PDF already had, in `pages[].source`.

### How much does OCR cost?

| Event | Price | When it is charged |
| --- | --- | --- |
| File processed | $0.002 | Once per file that produced text |
| Page read with OCR | $0.009 | Per page that actually needed OCR |

**Pages that already contain text are not charged as OCR pages**, and files that fail are returned as `error` rows at no cost. A 20-page PDF where only 6 pages are scans costs $0.002 + 6 × $0.009 = $0.056, not the price of 20 pages.

| Job | Cost |
| --- | --- |
| 1,000 scanned photos | $11.00 |
| 100 scanned PDFs, 10 pages each | $9.20 |
| 500 mixed PDFs, a third of pages scanned | $16.00 |

Comparable OCR Actors charge $15 per 1,000 scanned pages. The Apify Free plan includes $5 of monthly usage, which is about **550 scanned pages**.

### How to read text from a scan

1. Click **Try for free** and sign in to Apify.
2. Paste image or PDF links into **Image or PDF URLs**, or use **Upload a file**.
3. Pick the **OCR language** — this matters more than any other setting for accuracy.
4. Switch on **Word positions and confidence** if you need boxes.
5. Press **Start**, then read the **Output** tab or export as JSON, CSV or Excel.

### ⬇️ Input

![OCR Text Extractor input: image and scanned PDF URLs, OCR language, word boxes and confidence settings](https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/ocr-text-extractor/ocr-text-extractor-input-form.png)

```json
{
  "urls": ["https://example.com/scanned-invoice.pdf"],
  "language": "eng",
  "includePages": true,
  "includeWordBoxes": false,
  "useExistingTextLayer": true
}
```

#### Picking the language

Accuracy on a good scan is mostly a question of the right language pack. Nineteen are installed: English, German, French, Spanish, Portuguese, Italian, Dutch, Polish, Russian, Ukrainian, Turkish, Indonesian, Vietnamese, Arabic, Hindi, Chinese (simplified and traditional), Japanese and Korean.

If you do not know the language in advance, switch on **Detect the script automatically**. The page is inspected first and the language is switched when the script is clearly Cyrillic, Arabic, Chinese, Japanese, Korean or Devanagari.

#### Filtering out unreliable words

`minWordConfidence` drops words the engine is less sure about than the number you give, from 0 to 100. On a clean scan almost everything sits above 90; on a phone photo of a receipt, setting 60 removes most of the nonsense.

#### Skipping pages that do not need OCR

`useExistingTextLayer` is on by default: a PDF page that already contains text is copied rather than re-recognised. That is faster, more accurate and cheaper. Switch it off when a PDF has a bad text layer and you want the picture read instead.

### ⬆️ Output

![OCR Text Extractor output: recognised text per file with page counts, language, word count and confidence score](https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/ocr-text-extractor/ocr-text-extractor-output-table.png)

```json
{
  "source": "https://…/sample-scan.png",
  "format": "image",
  "pageCount": 1,
  "pagesRead": 1,
  "ocrPageCount": 1,
  "language": "eng",
  "text": "INVOICE 2026-114\nMalina Data\nJalan Raya Uluwatu 88, Jimbaran, Bali\nConsulting services 1,250.00 USD",
  "wordCount": 26,
  "confidence": 93.7,
  "pages": [
    { "number": 1, "text": "INVOICE 2026-114…", "confidence": 93.7, "wordCount": 26, "source": "ocr" }
  ],
  "status": "ok",
  "extractedAt": "2026-09-05T09:14:02+00:00"
}
```

With **Word positions and confidence** switched on, each page also carries its words:

```json
{ "text": "INVOICE", "confidence": 95, "left": 124, "top": 168, "width": 174, "height": 32 }
```

Coordinates are in pixels of the rendered page, measured from the top-left corner.

#### Error rows

| `errorCode` | Meaning |
| --- | --- |
| `network-error` / `http-error` | The file could not be downloaded |
| `too-large` | The file is above the size limit |
| `unsupported-format` | The file is neither an image nor a PDF |
| `corrupt-file` | The file is damaged |
| `no-text-found` | Nothing readable was found — usually the wrong language or a very low-resolution scan |

### Use cases

#### Digitising paperwork

Invoices, permits, contracts and old records that only exist as scans become searchable text, with a confidence score that tells you which ones need a human.

#### Feeding scans to an LLM

A model cannot read a JPEG of a contract. Run it through here first and pass the text, with the low-confidence words filtered out.

#### Building a document parser

Word boxes let you read a field by where it sits on the page — the invoice number in the top right, the total above the signature — rather than by guessing from a wall of text.

#### Screenshots and photos

Text in screenshots, product labels and signs is read the same way as a document scan.

### Integrations

- **API**: `POST https://api.apify.com/v2/acts/lergassy~ocr-text-extractor/runs`
- **Python**: `ApifyClient(token).actor('lergassy/ocr-text-extractor').call(run_input={'urls': [...]})`
- **JavaScript**: `await client.actor('lergassy/ocr-text-extractor').call({ urls: [...] })`
- **n8n, Make, Zapier, Google Sheets**: run the Actor and map the dataset onward.
- **MCP**: available through the Apify MCP server as a callable tool.
- **Webhooks**: fire a webhook when a run finishes.

### 🤖 For AI agents and LLM apps

```json
{ "urls": ["https://example.com/scan.png"], "language": "eng" }
```

- One row per file; `status` is `ok` or `error`, so a failed file needs no log parsing.
- `confidence` gives an agent a reason to ask for a better scan instead of acting on noise.
- `pages[].source` says whether text was recognised or copied from a text layer.
- Files can be passed as base64, so an agent does not need to host anything.
- Failed files are never charged.

### ❓ FAQ

#### How accurate is it?

On a clean 200-DPI scan in the right language, high — the sample invoice in this README reads at 94% average confidence. On phone photos, handwriting or heavy stamps, accuracy drops, which is exactly why every result carries a confidence score instead of pretending to be certain.

#### Does it read handwriting?

Not reliably. The engine is built for printed text.

#### What is the difference from Document Text Extractor?

[Document Text Extractor](https://apify.com/lergassy/document-text-extractor) is for documents that already contain text — PDF, Word, Excel, PowerPoint — and turns them into Markdown, tables and RAG chunks. This Actor is for pictures of text, and returns confidence scores and word positions. Use that one for files, this one for scans.

#### Do I need an API key for the OCR engine?

No. The recognition runs inside the Actor, so there is no external service, no key and no per-call quota.

#### Can I use it with the Apify API or an MCP server?

Yes to both, like any Apify Actor.

#### What is the largest file it can read?

50 MB by default, adjustable to 200 MB. Page count per file is capped at 50 by default so a long scan cannot surprise you.

### Your feedback

Missing a language, or a scan that reads badly? Open an issue on the **Issues** tab — issues are answered quickly.

### You might also like

| Actor | What it does |
| --- | --- |
| [Document Text Extractor](https://apify.com/lergassy/document-text-extractor) | PDF, Word, Excel and PowerPoint to Markdown, tables and RAG chunks |
| [Software Reviews Scraper](https://apify.com/lergassy/software-reviews-scraper) | Capterra, Software Advice, GetApp and TrustRadius reviews in one schema |
| [Email & Phone Verifier](https://apify.com/lergassy/email-phone-verifier) | Validate e-mail addresses and phone numbers, find contacts on a website |
| [US Business Leads](https://apify.com/lergassy/us-business-filings) | New business registrations from US state and city registries |

# Actor input Schema

## `urls` (type: `array`):

Direct links to the files you want to read: PNG, JPG, WEBP, TIFF, BMP, GIF, HEIC or PDF. Scanned PDFs are rendered page by page and read with OCR.

## `file` (type: `string`):

Upload one image or PDF from your computer instead of giving a URL.

## `base64Files` (type: `array`):

Base64-encoded images or PDFs for API and agent calls. Each entry is a plain base64 string (a data-URI prefix is allowed) or an object <code>{"fileName": "scan.png", "data": "…"}</code>.

## `language` (type: `string`):

Language of the text in the scan. Picking the right one is the single biggest factor in accuracy.

## `autoDetectLanguage` (type: `boolean`):

Look at the page first and switch language when the script is clearly Cyrillic, Arabic, Chinese, Japanese, Korean or Devanagari. Adds a moment per file.

## `includePages` (type: `boolean`):

Return each page separately with its own text and confidence score, alongside the full text.

## `includeWordBoxes` (type: `boolean`):

Return every recognised word with its confidence and its box on the page. Use it to highlight text or to build a document parser.

## `minWordConfidence` (type: `integer`):

Drop words the engine is less sure about than this, from 0 to 100. Raise it to cut noise out of poor scans.

## `useExistingTextLayer` (type: `boolean`):

When a PDF page already contains text, copy it instead of running OCR. Faster, cheaper and more accurate. Switch off to force OCR everywhere.

## `pageRange` (type: `string`):

Read only these PDF pages, for example <code>1-5</code>, <code>8</code> or <code>12-</code> (page 12 to the end).

## `maxPagesPerFile` (type: `integer`):

Safety cap so a long scan cannot run up an unexpected bill.

## `maxConcurrency` (type: `integer`):

How many files to read at the same time.

## `maxFileSizeMb` (type: `integer`):

Files larger than this are skipped with an error row instead of being downloaded.

## `timeoutPerFileSecs` (type: `integer`):

How long to wait for one file to download before giving up on it.

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/document-text-extractor/sample-scan.png",
    "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/document-text-extractor/sample-scan.pdf"
  ],
  "language": "eng",
  "autoDetectLanguage": false,
  "includePages": true,
  "includeWordBoxes": false,
  "minWordConfidence": 0,
  "useExistingTextLayer": true,
  "maxPagesPerFile": 50,
  "maxConcurrency": 3,
  "maxFileSizeMb": 50,
  "timeoutPerFileSecs": 120
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset with one row per image or PDF.

## `resultsInConsole` (type: `string`):

Browse the OCR results in the Apify Console.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/document-text-extractor/sample-scan.png",
        "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/document-text-extractor/sample-scan.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("lergassy/ocr-text-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/document-text-extractor/sample-scan.png",
        "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/document-text-extractor/sample-scan.pdf",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("lergassy/ocr-text-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/document-text-extractor/sample-scan.png",
    "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/document-text-extractor/sample-scan.pdf"
  ]
}' |
apify call lergassy/ocr-text-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lergassy/ocr-text-extractor"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/DQEK1i2iJ5UMXXbCf/builds/5R4qrsxTcp6DBukAJ/openapi.json
