# PDF & Image to Text (OCR) — Scanned PDFs, Photos, Screenshots (`tidydata/pdf-image-text-extractor`) Actor

Extract text from PDFs and images by URL. Exact text from digital PDFs, automatic OCR (Tesseract) for scanned pages, photos and screenshots in 8 languages. Page-by-page output, ready for LLMs, search and RAG pipelines.

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

## Pricing

from $1.60 / 1,000 ocr pages

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?

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

## 📄 PDF & Image to Text (OCR) — scanned PDFs, photos and screenshots

Turn **any PDF or image URL into clean text**. Digital PDFs are read exactly from their text layer (fast and cheap). **Scanned pages, photos and screenshots are read with OCR** (Tesseract) in **8 languages**. You get the full text plus page-by-page text, ready for LLMs, RAG pipelines, search indexes or spreadsheets.

- ✅ PDFs, PNG, JPG, TIFF (multi-page), WEBP, GIF, BMP
- ✅ **Auto mode**: uses the PDF's real text when it exists and only OCRs pages without text, so you never pay OCR prices for digital pages
- ✅ OCR languages: English, Spanish, French, German, Italian, Portuguese, Dutch, Catalan (combine several)
- ✅ Page-by-page output for citations and chunking
- ✅ Password-protected PDFs are detected and reported, never cracked
- ✅ Your files are only downloaded during the run to extract the text; nothing else is kept

### How to use it

1. Paste one or more **file URLs** (one per line, or upload a list).
2. Keep **Auto** mode (recommended) and pick the **OCR languages** of your scanned documents.
3. Run. Each file becomes one row in the dataset; export it as JSON, CSV, Excel or straight to your app via API.

### Output example

```json
{
  "url": "https://arxiv.org/pdf/1706.03762",
  "fileName": "1706.03762",
  "fileType": "pdf",
  "fileSizeBytes": 2215244,
  "pageCount": 15,
  "pagesProcessed": 15,
  "pagesOcr": 0,
  "pagesTextLayer": 15,
  "method": "text",
  "ocrLanguages": null,
  "charCount": 39605,
  "wordCount": 6113,
  "text": "Provided proper attribution is provided, Google hereby grants permission to reproduce the tables and figures in this paper…",
  "truncated": false,
  "processingSeconds": 0.62,
  "error": null,
  "pages": [{ "page": 1, "method": "text", "text": "…" }]
}
```

If a file can't be processed (broken link, unsupported format, password-protected, too big) you get a row with the `error` explained and you are **not charged** for it.

### Use cases

- 🤖 **AI & RAG** — feed PDFs and scans to ChatGPT, Claude or your vector database with page numbers for citations.
- 🧾 **Invoices, receipts and forms** — get the text out of scanned paperwork for bookkeeping or data entry automations.
- 📚 **Research** — bulk-extract papers, reports and public documents.
- 🔎 **Search & archiving** — make scanned archives searchable.
- 🖼️ **Screenshots & photos of documents** — read text from images in workflows (Make, Zapier, n8n).

### Pricing

Pay only for pages actually processed:

- **Text-layer page** (digital PDF): cheap, charged per page.
- **OCR page** (scanned page or image): charged per page.

Use `maxPagesPerFile` to cap the cost of very long documents. Failed files are free.

### Tips for the best OCR results

- Select only the languages that appear in your documents.
- Higher-resolution scans (≥ 200 DPI) give noticeably better results.
- Handwriting is not supported reliably (OCR is designed for printed text).

### FAQ

**Does it work with Make, Zapier or n8n?** Yes — call the Actor via the Apify integration or API and read the dataset.

**Is my data stored?** Files are downloaded only for the duration of the run to extract text. The result stays in your own Apify dataset, under your control.

**Can it read tables?** Text from tables is extracted in reading order. Cell structure is not reconstructed.

# Actor input Schema

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

Public URLs of PDFs or images (PNG, JPG, TIFF, WEBP, GIF, BMP). One result per file.

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

Auto: use the PDF's own text when it exists and OCR only pages without text (cheapest and most accurate). Text only: never OCR. OCR: force OCR on every page.

## `ocrLanguages` (type: `array`):

Languages present in scanned documents and images. Selecting only the ones you need gives better accuracy.

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

Adds a 'pages' array with the text of each page (useful for citations and RAG chunking).

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

Only the first N pages of each file are processed (and charged).

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

Files bigger than this are skipped.

## Actor input object example

```json
{
  "files": [
    {
      "url": "https://arxiv.org/pdf/1706.03762"
    }
  ],
  "mode": "auto",
  "ocrLanguages": [
    "eng"
  ],
  "includePages": true,
  "maxPagesPerFile": 200,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

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

One row per file with the full extracted text, page-by-page text and processing details.

# 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://arxiv.org/pdf/1706.03762"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidydata/pdf-image-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 = { "files": [{ "url": "https://arxiv.org/pdf/1706.03762" }] }

# Run the Actor and wait for it to finish
run = client.actor("tidydata/pdf-image-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 '{
  "files": [
    {
      "url": "https://arxiv.org/pdf/1706.03762"
    }
  ]
}' |
apify call tidydata/pdf-image-text-extractor --silent --output-dataset

```

## MCP server setup

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