# OCR Text Extractor: Images and Scanned PDFs (`clearcheck/ocr-text-extractor`) Actor

OCR text extractor for images and scanned PDFs: Tesseract runs inside the Actor, 100+ languages, confidence scores and word boxes. No external API.

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

## Pricing

from $4.00 / 1,000 page ocrs

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## OCR Text Extractor: Images and Scanned PDFs

Extract text from **images (PNG, JPEG, WebP, BMP) and scanned PDFs**. OCR runs inside the Actor with Tesseract: your files are not sent to any third-party service, there is no AI bill, and results are returned with a confidence score per page.

Pages of a PDF that already contain real text are **read directly** (exact, cheaper) and only the scanned pages go through OCR.

### What you get

- Full `text` per file, plus per-page text with `method` (`ocr` or `text-layer`) and `confidence` (0-100).
- `lowConfidencePages`: pages under the threshold you set, so you can review only those.
- Optional **word positions**: every word with confidence and bounding box `[x0, y0, x1, y1]`.
- Languages: English, French, Spanish, German, Portuguese and Italian are bundled (fast start); any other Tesseract language (Dutch, Russian, Arabic, Japanese, Simplified Chinese, Korean, Hindi, Turkish, Polish...) is downloaded at start. Combine several for mixed documents (`["eng", "fra"]`).
- Layout modes for screenshots, receipts and labels (single line, sparse text).
- A failed file never stops the run and is never charged.

### Quick start

1. Paste image or PDF URLs in **Image / PDF URLs** (or upload files to a key-value store and list their keys).
2. Choose the **language** of the document.
3. Click **Start** and open the **Output** tab.

### Input

| Field | Description | Default |
|---|---|---|
| `urls` | Public URLs of images or PDFs (format detected from content). | - |
| `kvStoreKeys`, `kvStoreId` | Files stored in a key-value store. | - |
| `languages` | Tesseract codes, e.g. `["eng"]`, `["fra","eng"]`. | `["eng"]` |
| `pageSegmentation` | `3` auto page, `4` column, `6` block, `7` single line, `11`/`12` sparse text. | `3` |
| `includeWords` | Add word boxes and confidences. | `false` |
| `minConfidence` | Flag pages below this average confidence. | `0` |
| `pdfForceOcr` | OCR every PDF page even when it has a text layer. | `false` |
| `maxPagesPerPdf` | Only the first N pages (0 = all). | `0` |
| `pdfScale` | Render zoom for scanned pages (2 is about 144 dpi). | `2` |
| `pdfPassword` | Password for protected PDFs (secret). | - |
| `concurrency` | Parallel OCR workers (about 300 MB each). | `2` |
| `maxFileSizeMb` | Skip larger files (not charged). | `25` |

Example input:

```json
{
  "urls": ["https://tesseract.projectnaptha.com/img/eng_bw.png"],
  "languages": ["eng"]
}
```

### Output

Real output of that input (confidence 92, 616 ms):

```json
{
  "source": { "type": "url", "url": "https://tesseract.projectnaptha.com/img/eng_bw.png" },
  "status": "ok",
  "format": "png",
  "pageCount": 1,
  "pagesOcr": 1,
  "pagesTextLayer": 0,
  "text": "Mild Splendour of the various-vested Night!\nMother of wildly-working visions! hail\nI watch thy gliding, while with watery light\n...",
  "confidence": 92,
  "lowConfidencePages": [],
  "pages": [{ "page": 1, "method": "ocr", "confidence": 92, "text": "Mild Splendour of the various-vested Night! ..." }],
  "languages": ["eng"]
}
```

### Use cases

- **Digitise paperwork**: turn scanned invoices, receipts, forms and letters into searchable text.
- **Data extraction pipelines**: extract text from screenshots and images collected by other Actors.
- **Archives**: make scanned PDF documents searchable and ready for indexing.
- **AI and RAG**: feed the extracted text to a language model or a vector store.

### Pricing

Pay per event. You can cap spending with the maximum cost per run.

| Event | Price | When it is charged |
|---|---|---|
| Page OCR | $0.004 | Once per image, or per PDF page recognised by OCR |
| PDF page read from text layer | $0.0005 | Once per PDF page that already contained text (no OCR needed) |

Examples: one image = $0.004; a 10-page scanned PDF = $0.04; a 10-page PDF with a real text layer = $0.005. Failed, unreadable or oversized files cost nothing.

### Quality and limits (read before you rely on it)

- Tesseract is very good on clean printed text (tested: 92-95 percent average confidence on rendered text and a book page) and weaker on handwriting, low-resolution photos, curved or skewed pages, and complex tables. It does not detect table structure.
- Confidence is Tesseract's own estimate, not a guarantee. Use `minConfidence` to route doubtful pages to a human or another tool.
- Not supported: GIF and TIFF (convert to PNG/JPEG first), handwriting recognition, password-protected images.
- Speed on the platform at 2 GB memory: about 0.6 s for a clean image, about 2-3 s per scanned PDF page (6 pages of a research paper in 18 s with 3 workers, including start-up).

### FAQ

**Which languages are supported?** English, French, Spanish, German, Portuguese and Italian are bundled; any other Tesseract language is downloaded at start. Accuracy depends on image quality and language.

**Does it handle handwriting?** Not reliably. Tesseract works best on clean printed text.

**What happens to a PDF that already has text?** The text layer is read directly, which is faster and cheaper than OCR.

**Do you send my files to an external service?** No. Recognition runs inside the Actor.

### More Actors by clearcheck

- [Email Validator](https://apify.com/clearcheck/email-validator)
- [Domain Health Checker](https://apify.com/clearcheck/domain-health-checker)
- [Broken Link Checker and Sitemap SEO Auditor](https://apify.com/clearcheck/link-sitemap-audit)
- [PDF, DOCX and HTML to Markdown Converter](https://apify.com/clearcheck/document-to-markdown-converter)
- [Website Contact Finder](https://apify.com/clearcheck/website-contact-finder)
- [Bulk Phone Number Validator](https://apify.com/clearcheck/phone-validator)
- [Bulk Image Optimizer](https://apify.com/clearcheck/image-optimizer)
- [Dataset Merger and Deduplicator](https://apify.com/clearcheck/dataset-merge-dedupe)
- [Excel and CSV to JSON Converter](https://apify.com/clearcheck/spreadsheet-to-json)

# Actor input Schema

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

Public URLs of PNG, JPEG, WebP, BMP images or PDF files. The format is detected from the content.

## `kvStoreKeys` (type: `array`):

Keys of files you stored in a key-value store (Storage > Key-value stores).

## `kvStoreId` (type: `string`):

Store that holds the files above. Leave empty to use the run's default store.

## `languages` (type: `array`):

Tesseract language codes: eng, fra, deu, spa, por, ita (bundled, fastest start) or any other such as nld, rus, ara, jpn, chi_sim, kor, hin, tur, pol (downloaded at start). Several allowed for mixed documents, for example eng and fra.

## `pageSegmentation` (type: `string`):

How Tesseract expects the text to be laid out. Use 'Single line' or 'Sparse text' for screenshots, labels, receipts or scattered text.

## `includeWords` (type: `boolean`):

Adds every recognised word with its confidence and bounding box \[x0, y0, x1, y1] in pixels.

## `minConfidence` (type: `integer`):

Pages recognised with a lower average confidence are listed in lowConfidencePages so you can review them. Nothing is dropped.

## `pdfForceOcr` (type: `boolean`):

By default pages that already contain text are read directly (cheaper, exact). Turn on when the text layer is garbage.

## `maxPagesPerPdf` (type: `integer`):

Process only the first N pages of each PDF (0 = all).

## `pdfScale` (type: `number`):

Scanned pages are rendered at this zoom before OCR. 2 is about 144 dpi for a standard page; raise to 3 for small print (slower).

## `pdfPassword` (type: `string`):

Password for protected PDFs.

## `concurrency` (type: `integer`):

More workers process PDF pages faster but need more memory (about 300 MB each). With the default 2 GB memory, 2 to 4 is safe.

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

Larger files are skipped and not charged.

## `requestTimeoutSecs` (type: `integer`):

Give up on a URL after this many seconds.

## Actor input object example

```json
{
  "urls": [
    "https://example.com/scan.pdf"
  ],
  "languages": [
    "eng"
  ],
  "pageSegmentation": "3",
  "includeWords": false,
  "minConfidence": 0,
  "pdfForceOcr": false,
  "maxPagesPerPdf": 0,
  "pdfScale": 2,
  "concurrency": 2,
  "maxFileSizeMb": 25,
  "requestTimeoutSecs": 60
}
```

# Actor output Schema

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

One item per file (errors have status = error).

## `summary` (type: `string`):

Files and pages processed.

# 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://tesseract.projectnaptha.com/img/eng_bw.png"
    ],
    "languages": [
        "eng"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("clearcheck/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://tesseract.projectnaptha.com/img/eng_bw.png"],
    "languages": ["eng"],
}

# Run the Actor and wait for it to finish
run = client.actor("clearcheck/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://tesseract.projectnaptha.com/img/eng_bw.png"
  ],
  "languages": [
    "eng"
  ]
}' |
apify call clearcheck/ocr-text-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,clearcheck/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/EZWkhB76GiJPUqvhw/builds/L6sYVhIU0rGP0NzZP/openapi.json
