# Bulk OCR – Image & Scanned PDF to Text (100+ Languages) (`fast_data_asap/bulk-ocr-image-to-text`) Actor

Extract text from images and scanned PDFs in bulk with Tesseract OCR: JPG, PNG, TIFF, WebP and PDF URLs to plain text, lines or words with bounding boxes and confidence. 100+ languages, auto deskew, no API key. Pay only per OCR'd page.

- **URL**: https://apify.com/fast_data_asap/bulk-ocr-image-to-text.md
- **Developed by:** [Fast Data](https://apify.com/fast_data_asap) (community)
- **Categories:** AI, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 ocr'd pages

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

## Bulk OCR – Image & Scanned PDF to Text (Tesseract, 100+ Languages)

Extract text from **images and scanned PDFs in bulk**. Paste a list of image or PDF URLs and get back clean text for every image and every PDF page, with a confidence score and, if you want, **every line and word with its bounding box**. Powered by the open-source **Tesseract OCR** engine, so there are **no API keys, no OpenAI/Google Vision bills and no per-call quotas**.

**$1 per 1,000 OCR'd pages. You only pay for pages where text was recognised.** Failed downloads, unsupported files and blank pages are listed with a status and cost nothing.

#### What it does

- 🖼️ **Images**: JPG, PNG, TIFF (including multi-page TIFF), WebP, BMP, GIF
- 📄 **PDFs**: scanned or digital, every page is rendered to an image (PyMuPDF) and OCR'd; limit pages per file with `maxPagesPerPdf`
- 🌍 **100+ languages**: English, German, French, Spanish, Italian, Dutch, Polish and Portuguese are built in. Any other Tesseract language (Japanese `jpn`, Chinese `chi_sim`/`chi_tra`, Arabic `ara`, Russian `rus`, Ukrainian `ukr`, Hindi `hin`, Korean `kor`, Turkish `tur`, ...) is downloaded automatically on first use. Combine them with `+`, e.g. `eng+fra`
- 📐 **Three output levels**: plain text, text + lines, or text + lines + words, each with `x`, `y`, `w`, `h` bounding boxes and confidence
- 🧹 **Auto preprocessing**: grayscale, contrast stretch, upscaling of small images, **automatic deskew** of slightly crooked scans and binarization. Optional **auto-rotate** for sideways or upside-down pages
- ⚡ **Fast and cheap**: a typical page takes 1–4 seconds; runs in 1 GB of memory

**Who it's for:** anyone digitising scanned documents, invoices, letters, book pages, archive material or screenshots; developers who need OCR inside a pipeline (n8n, Make, Zapier, LangChain, AI agents) without managing Tesseract themselves; RAG builders who need text from scanned PDFs.

**Why this actor:** most OCR actors in the Store charge $1.50–$12 per 1,000 pages. This one is $1 per 1,000 pages, free for failures and blank pages, supports 100+ languages and returns word-level boxes for layout work.

#### Honest note on quality

Tesseract is excellent on **printed text**: scans, PDFs, screenshots, book pages, typed letters (typically 90–99 % word confidence on clean scans). It is **mediocre on photos** with perspective, glare or busy backgrounds, and **poor on handwriting**. Tables are read line by line, not as structured tables. Use `meanConfidence` to spot pages that need a human look. If you need handwriting recognition, a vision LLM or a cloud OCR API is the better (and more expensive) choice.

### Input

| Field | Default | Description |
|---|---|---|
| `urls` | 2 Tesseract test images | Public image or PDF URLs. Type is detected from the file content |
| `languages` | `eng+deu` | Tesseract language codes joined with `+`. Fewer languages = faster, more accurate |
| `outputLevel` | `text` | `text`, `lines` or `words` (adds bounding boxes) |
| `preprocess` | `true` | Grayscale, contrast, upscale, deskew, binarize |
| `autoRotate` | `false` | Detect and fix 90/180/270° rotated pages |
| `psm` | `3` | Tesseract page segmentation mode: 3 auto, 4 single column, 6 single block, 7 single line, 11 sparse text (screenshots, signs) |
| `maxPagesPerPdf` | `20` | Only the first N pages of each PDF / multi-page TIFF |
| `pdfDpi` | `200` | Render resolution for PDF pages (300 for small print) |
| `minConfidence` | `0` | Drop words below this confidence (0–100) |
| `maxFileSizeMb` | `50` | Skip larger files (free) |
| `maxConcurrency` | `2` | Pages OCR'd in parallel |

```json
{
  "urls": [
    "https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf",
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
  ],
  "languages": "eng",
  "outputLevel": "words",
  "maxPagesPerPdf": 2
}
```

### Output

One dataset item per image or PDF page. Real example from a test run (default input):

```json
{
  "sourceUrl": "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/eurotext.tif",
  "page": 1,
  "pageCount": 1,
  "sourceType": "image",
  "language": "eng+deu",
  "status": "ok",
  "text": "The (quick) [brown] {fox} jumps!\nOver the $43,456.78 <lazy> #90 dog\n& duck/goose, as 12.5% of E-mail\nfrom aspammer@website.com is spam.\nDer „schnelle” braune Fuchs springt\nüber den faulen Hund. Le renard brun\n«rapide» saute par-dessus le chien\nparesseux. ...",
  "meanConfidence": 92.4,
  "wordCount": 66,
  "lineCount": 12,
  "charCount": 347,
  "width": 1024,
  "height": 800,
  "rotated": 0,
  "deskewAngle": 0.8,
  "processingMs": 1234,
  "error": null
}
```

With `outputLevel: "words"` each item also has `lines` and `words` arrays. Coordinates are pixels of the original image (for PDFs: of the page rendered at `pdfDpi`):

```json
"words": [
  { "text": "Trace-based", "confidence": 90, "x": 225, "y": 220, "w": 257, "h": 35, "block": 1, "paragraph": 1, "line": 1 }
]
```

| Field | Meaning |
|---|---|
| `status` | `ok` (text found, charged), `empty` (no text found, free), `error` (download/file/OCR problem, free) |
| `page` | 1-based page number (`null` when the whole file failed) |
| `pageCount` | Total pages in the source file |
| `meanConfidence` | Average word confidence 0–100 |
| `text` | Recognised text; line breaks kept, blank line between paragraphs |
| `deskewAngle`, `rotated` | Corrections applied by preprocessing |
| `error` | Reason for `error` rows, e.g. `HTTP 404 when downloading`, `PDF is password protected` |

### Pricing

Pay per event: **$0.001 per OCR'd page** (an image counts as one page). 1,000 scanned pages cost $1. Errors and pages without any text are free. Set a maximum cost per run in the run options and the actor stops cleanly when it is reached.

### Use via API, n8n, Make or AI agents

**API** (synchronous, returns the dataset items):

```bash
curl -X POST "https://api.apify.com/v2/acts/fast_data_asap~bulk-ocr-image-to-text/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls":["https://example.com/scan.pdf"],"languages":"eng","maxPagesPerPdf":5}'
```

**Python:**

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_TOKEN")
run = client.actor("fast_data_asap/bulk-ocr-image-to-text").call(run_input={"urls": ["https://example.com/invoice.png"], "languages": "eng"})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["page"], item["meanConfidence"], item["text"][:200])
```

**n8n / Make / Zapier:** use the Apify node/app, action "Run actor", actor `fast_data_asap/bulk-ocr-image-to-text`, then read the dataset items.

**MCP (Claude, Cursor, other AI agents):** add `https://mcp.apify.com?tools=fast_data_asap/bulk-ocr-image-to-text` as an MCP server and let your agent OCR images and PDFs on demand.

### Adding more languages

Just put the code in `languages`; missing language data is downloaded from the official `tesseract-ocr/tessdata_fast` repository at the start of the run (a few seconds). The full list of codes is in the [Tesseract documentation](https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html). If you fork the actor and want a language baked into the image, add its Debian package (e.g. `tesseract-ocr-jpn`) to the `apt-get install` line in the Dockerfile.

### FAQ

**Can it read files from Google Drive or Dropbox?** Yes, if you use a direct download link that returns the file itself (not an HTML preview page).

**Does it handle digital (non-scanned) PDFs?** Yes, they are rendered and OCR'd like scans. For digital PDFs a text extractor is faster and exact, but OCR works when the text layer is broken or missing.

**Is my data stored?** Files are only downloaded into the run's container for processing; results go to your own Apify dataset.

# Actor input Schema

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

Public URLs of images (JPG, PNG, TIFF incl. multi-page, WebP, BMP, GIF) or PDFs (scanned or digital). The file type is detected automatically.

## `languages` (type: `string`):

Tesseract language codes joined with '+', e.g. eng, eng+deu, fra+spa, jpn, chi_sim, ukr, ara. Built in: eng, deu, fra, spa, ita, nld, pol, por. Any other of the 100+ Tesseract languages is downloaded automatically on first use. Fewer languages = faster and more accurate.

## `outputLevel` (type: `string`):

text = full text only. lines = also every text line with bounding box and confidence. words = also every word with bounding box and confidence.

## `preprocess` (type: `boolean`):

Grayscale, contrast stretch, upscale small images, straighten slightly skewed scans (deskew) and binarize before OCR. Recommended for scans and phone photos of documents.

## `autoRotate` (type: `boolean`):

Detect pages that are upside down or sideways and rotate them before OCR. Adds roughly 0.5 s per page.

## `psm` (type: `integer`):

Tesseract --psm. 3 = fully automatic (default, documents). 4 = single column. 6 = single uniform block of text. 7 = single line. 11 = sparse text (screenshots, signs, memes). 12 = sparse text with orientation detection.

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

Only the first N pages of each PDF or multi-page TIFF are OCR'd.

## `pdfDpi` (type: `integer`):

Resolution used to render PDF pages to images. 200 is fast and good for normal text, 300 is better for small print.

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

Words recognised with a lower confidence (0–100) are dropped from the text and word list. 0 keeps everything.

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

Larger downloads are skipped with an error (free).

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

Pages OCR'd in parallel. Higher values need more memory (about 1 per 512 MB is a good rule).

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif",
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/eurotext.tif"
  ],
  "languages": "eng+deu",
  "outputLevel": "text",
  "preprocess": true,
  "autoRotate": false,
  "psm": 3,
  "maxPagesPerPdf": 20,
  "pdfDpi": 200,
  "minConfidence": 0,
  "maxFileSizeMb": 50,
  "maxConcurrency": 2
}
```

# Actor output Schema

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

No description

# 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/tesseract-ocr/test/main/testing/phototest.tif",
        "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/eurotext.tif"
    ],
    "languages": "eng+deu",
    "maxPagesPerPdf": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("fast_data_asap/bulk-ocr-image-to-text").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/tesseract-ocr/test/main/testing/phototest.tif",
        "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/eurotext.tif",
    ],
    "languages": "eng+deu",
    "maxPagesPerPdf": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("fast_data_asap/bulk-ocr-image-to-text").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/tesseract-ocr/test/main/testing/phototest.tif",
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/eurotext.tif"
  ],
  "languages": "eng+deu",
  "maxPagesPerPdf": 20
}' |
apify call fast_data_asap/bulk-ocr-image-to-text --silent --output-dataset

```

## MCP server setup

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

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/jKWPUzujcXt1nOaZW/builds/DcMPxr0utOOefas2J/openapi.json
