# OCR: Image & Scanned PDF to Text (Bulk, 8 languages) (`toowl/ocr-image-pdf-to-text`) Actor

Extract text from photos, screenshots, receipts and scanned PDFs in bulk from URLs with Tesseract OCR. 8 languages incl. English, Indonesian, Spanish, French, German. Digital PDFs read directly. No third-party API. Pay per page.

- **URL**: https://apify.com/toowl/ocr-image-pdf-to-text.md
- **Developed by:** [Chalid Ade](https://apify.com/toowl) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 page read (ocr)s

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/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 — Image & Scanned PDF to Text in bulk

Extract text from **photos, screenshots, receipts, invoices, ID cards, book pages and scanned PDFs**. Give a list of URLs, get clean text back, one dataset row per file. Powered by Tesseract OCR (LSTM models).

### Why use it

- **Images and PDFs** in one Actor: JPG, PNG, WebP, AVIF, GIF, TIFF and multi-page PDFs.
- **Smart with PDFs**: pages that already have real text (digital PDFs) are read directly, so they are exact and fast. Only scanned pages are OCR'd.
- **8 languages**: English, Indonesian/Malay, Spanish, French, German, Portuguese, Italian, Dutch. Mix them (e.g. `["eng", "spa"]`).
- **Pre-processing built in**: EXIF rotation, transparent PNGs flattened, small screenshots enlarged so tiny text reads well.
- **Layout modes** for documents, receipts/crops, or sparse text such as labels and UI screenshots.
- **Confidence score** per file (and per page) so you can flag poor scans.
- **No third-party API**: OCR runs inside the run; files are not sent anywhere else.

### Input

```json
{
  "files": [
    { "url": "https://example.com/receipt.jpg" },
    { "url": "https://example.com/scanned-contract.pdf" }
  ],
  "languages": ["eng"],
  "pageSegmentation": "auto",
  "maxPages": 50
}
```

### Output

```json
{
  "url": "https://example.com/receipt.jpg",
  "name": "receipt.jpg",
  "kind": "image",
  "pages": 1,
  "confidence": 93,
  "characters": 412,
  "text": "INVOICE #2026-0117\n\nDate: 27 November 2026\n..."
}
```

Turn on **Save a .txt file** for a download link per file, or **Include per-page text** to get `pageTexts` for PDFs (page number, text, confidence, and `source`: `ocr` or `text-layer`).

### Use cases

- Digitise scanned contracts, letters and archives for search or AI/RAG pipelines
- Read receipts and invoices before parsing totals and dates
- Pull text out of screenshots and social-media images
- Make product labels and packaging photos searchable

### Pricing

Pay per event: a fee per image or **per PDF page** read (see the Pricing tab). Files that fail are free. Cap spending with "Max cost per run" and "Max pages per PDF".

### Free browser version

[toowl.my.id/tools/ocr](https://toowl.my.id/tools/ocr/) reads text from a picture in your browser, free.

Engine: Tesseract OCR via tesseract.js (Apache-2.0); language models from tessdata (Apache-2.0).

# Actor input Schema

## `files` (type: `array`):

Direct links to photos, screenshots, scans (JPG, PNG, WebP, AVIF, GIF, TIFF) or PDFs, including scanned PDFs.

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

Languages in the documents. Pick only the ones you need: each extra language slows OCR down a little.

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

auto suits documents and pages. single-block suits receipts, cards and cropped text. sparse finds scattered text (labels, signs, screenshots).

## `useTextLayer` (type: `boolean`):

Pages of a digital (non-scanned) PDF are read directly: exact and fast. Turn off to OCR every page.

## `maxPages` (type: `integer`):

Only the first pages are read; each page is charged.

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

Scanned PDF pages are rendered at this resolution before OCR. 200 suits most scans; 300 helps with small print.

## `saveTextFiles` (type: `boolean`):

Adds a download link to a plain-text file next to the text in the dataset.

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

Adds pageTexts: page number, text, confidence and whether it came from OCR or the text layer.

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

Larger files are skipped with an error (not charged).

## Actor input object example

```json
{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/invoice.jpg"
    }
  ],
  "languages": [
    "eng"
  ],
  "pageSegmentation": "auto",
  "useTextLayer": true,
  "maxPages": 50,
  "pdfDpi": 200,
  "saveTextFiles": false,
  "includePages": false,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

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

One row per input file, with a download link for the result where there is one.

## `files` (type: `string`):

Result files in the default key-value store, plus a SUMMARY record.

# 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 = {
    "files": [
        {
            "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/invoice.jpg"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("toowl/ocr-image-pdf-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 = { "files": [{ "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/invoice.jpg" }] }

# Run the Actor and wait for it to finish
run = client.actor("toowl/ocr-image-pdf-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 '{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/invoice.jpg"
    }
  ]
}' |
apify call toowl/ocr-image-pdf-to-text --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,toowl/ocr-image-pdf-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/pJn6LZWNUyhGJ0SWJ/builds/K2pTZ2J9dqRK8Rc4t/openapi.json
