# OCR: PDF & Image to Text (French, English and 5 more) (`klyve1/pdf-image-ocr`) Actor

Extract text from PDFs and images (PNG, JPG, TIFF, scans). Uses the embedded text when the PDF has it and runs Tesseract OCR on scanned pages. French, English, German, Spanish, Italian, Portuguese, Dutch.

- **URL**: https://apify.com/klyve1/pdf-image-ocr.md
- **Developed by:** [Nico Klyve](https://apify.com/klyve1) (community)
- **Categories:** AI, 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 $3.00 / 1,000 page processeds

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: PDF & Image to Text (French, English, German, Spanish, Italian, Portuguese, Dutch)

Send links to **PDFs or images** and get their **text back, page by page**. Digital PDFs are read directly (exact text, very fast); **scanned pages and photos go through Tesseract OCR**. Works with French, English, German, Spanish, Italian, Portuguese and Dutch documents, including mixed-language ones.

### What people use it for

- **Scanned contracts, invoices, letters and forms** turned into searchable text.
- **Document pipelines and RAG**: extract text from PDFs before sending it to an LLM or a search index.
- **Accounting and back office automation** with Make, n8n or Zapier: a new PDF arrives, its text lands in your sheet.
- **AI agents** that need to read a PDF or a screenshot from a URL.

### Example output (one row per page)

```json
{
  "fileUrl": "https://example.com/scan-contrat.pdf",
  "fileName": "scan-contrat.pdf",
  "fileType": "pdf",
  "fileSizeBytes": 845213,
  "pageCount": 3,
  "page": 1,
  "method": "ocr",
  "text": "CONTRAT DE PRESTATION DE SERVICES\n\nEntre les soussignés...",
  "languages": "eng+fra",
  "charCount": 2841,
  "wordCount": 452,
  "processedAt": "2026-11-15T20:00:00.000Z"
}
```

`method` tells you how the text was obtained: `embedded-text` (read from the PDF itself) or `ocr`.

### Input

| Field | Description |
|---|---|
| `files` | Public URLs of PDFs or images (PNG, JPG, TIFF, BMP, GIF, WebP), up to 60 MB each. |
| `languages` | Languages in the documents (default English + French). |
| `mode` | `auto`: embedded text first, OCR only for scanned pages. `ocr`: OCR every page. |
| `outputPerPage` | One row per page (default) or one row per file with the full text. |
| `maxPagesPerFile` | Process only the first N pages of long PDFs (default 50). |
| `dpi` | Rendering resolution for scanned pages (default 300). |
| `pageSegmentationMode` | Layout hint for Tesseract: 3 automatic, 4 single column, 6 single block, 11 sparse text. |

### Pricing

Pay per event: you pay **per page processed** (one image = one page). Files that can't be downloaded are free. Set a maximum charge per run in the Apify Console for a hard cap.

### Tips for the best results

- Choose only the languages present in your documents.
- Scans at 300 DPI or more give the best accuracy. For tiny print, set `dpi` to 400.
- For receipts and forms with scattered text, try `pageSegmentationMode` 11.
- Handwriting is not supported: Tesseract is built for printed text.

Your files are downloaded into a temporary folder, processed, then deleted at the end of each file. Questions? Open an issue on the Actor page, answers within 48 hours.

# Actor input Schema

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

Public links to PDF files or images (PNG, JPG, TIFF, BMP, GIF, WebP), one per line. Files up to 60 MB.

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

Languages present in the documents. Selecting only the languages you need gives better and faster results.

## `mode` (type: `string`):

Auto: use the text already embedded in the PDF when there is some, and run OCR only on scanned pages (fast and exact). OCR: always run OCR on every page.

## `outputPerPage` (type: `boolean`):

On: one row per page. Off: one row per file with the full text.

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

Only the first pages of long PDFs are processed.

## `dpi` (type: `integer`):

Resolution used to render scanned PDF pages before OCR. 300 is a good default; use 400 for small print.

## `pageSegmentationMode` (type: `integer`):

Tesseract page segmentation: 3 = automatic (default), 4 = single column, 6 = single block of text, 11 = sparse text (receipts, forms).

## Actor input object example

```json
{
  "files": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png"
  ],
  "languages": [
    "eng",
    "fra"
  ],
  "mode": "auto",
  "outputPerPage": true,
  "maxPagesPerFile": 50,
  "dpi": 300,
  "pageSegmentationMode": 3
}
```

# Actor output Schema

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

All rows produced by the run.

# 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": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("klyve1/pdf-image-ocr").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": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("klyve1/pdf-image-ocr").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": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png"
  ]
}' |
apify call klyve1/pdf-image-ocr --silent --output-dataset

```

## MCP server setup

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

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/EQng6AL8k3bJDHqqE/builds/IWaL4IEuGi5yEUIBR/openapi.json
