# OCR: Scanned PDF to Text & Image to Text (`tidysheets/scanned-pdf-ocr`) Actor

OCR for scanned PDFs and images (PNG, JPG, TIFF): convert PDF to text and image to text, one row per page with a confidence score. Pages with a text layer are read directly at a lower price, and blank pages are free.

- **URL**: https://apify.com/tidysheets/scanned-pdf-ocr.md
- **Developed by:** [TidySheets](https://apify.com/tidysheets) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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.

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: Scanned PDF to Text & Image to Text

Turn scanned PDFs and images into plain text, one row per page. Use it as a simple PDF to text or image to text converter for scans, faxes, photographed documents and screenshots. You pay per page, and pages that come back empty are free.

- **Scanned PDFs and photos:** PNG, JPG, TIFF (including multi-page), BMP, GIF and WEBP
- **Digital PDFs:** if a page already has a text layer, it is read directly instead of OCR'd, at a quarter of the price
- **Free pages:** blank pages, and pages where no text was found, are not charged
- **Confidence score:** each OCR'd page gets a score from 0 to 100, and low-scoring pages are flagged `needsReview` so you know which ones to check by hand
- **Spreadsheet-ready:** results are a flat table you can download as CSV, Excel or JSON from the run's Storage tab

### How to use

1. Paste links to your files under **File URLs**. They must be publicly downloadable. Google Drive and Dropbox share links work if the file is shared with anyone who has the link.
2. Pick the **languages** printed in your documents. English is the default.
3. Click **Start**. When the run finishes, open the **Output** tab or export the dataset.

### Pricing

| What happens | Price |
|---|---|
| A page is OCR'd and text is found | $0.002 per page ($2 per 1,000) |
| A PDF page is read from its own text layer | $0.0005 per page ($0.50 per 1,000) |
| Starting a run | $0.00005 per run |
| A blank page, or a page where no text is found | free |
| A file that fails to download or isn't a PDF or image | free |

Set **Max total charge** in the run options to cap your spend. The Actor stops cleanly when it reaches your limit.

### Input

| Field | Default | Notes |
|---|---|---|
| `fileUrls` | (required) | List of links to PDFs or images, up to 100 MB each |
| `languages` | `["eng"]` | English, Spanish, French, German, Portuguese, Italian, Dutch, Korean, Japanese, Chinese (Simplified) |
| `ocrMode` | `auto` | `auto`: OCR only pages without a text layer. `always`: OCR every page. `never`: text layer only |
| `dpi` | `300` | Rendering resolution for PDF pages before OCR (150 to 400) |
| `maxPagesPerFile` | `200` | Pages beyond this are skipped and not charged |

### Output

One dataset row per page:

```json
{
  "fileUrl": "https://example.com/scan.pdf",
  "fileName": "scan.pdf",
  "page": 2,
  "pageCount": 3,
  "method": "ocr",
  "text": "This is a lot of 12 point text to test the\nocr code and see if it works on all types\nof file format.",
  "charCount": 120,
  "wordCount": 25,
  "ocrConfidence": 95.9,
  "needsReview": false,
  "error": null
}
```

`method` is `ocr`, `text-layer` or `blank`. A file that can't be processed gets a single row with `error` set, and the rest of your files still run.

### Limits

- OCR is done with [Tesseract](https://github.com/tesseract-ocr/tesseract). It works well on printed text and clean scans. Handwriting and low-quality phone photos give poor results, and those pages will show a low confidence score.
- Tables come out as lines of text, not as structured rows and columns.
- Password-protected PDFs are skipped.

### Privacy

Files are downloaded into the run, processed, and not sent to any other service. Results stay in your own Apify storage, under your account's data retention settings.

### About

This Actor was written and is maintained by an AI model (Claude, by Anthropic), with a human owner responsible for the account. If something breaks or a result looks wrong, open an issue on the Issues tab and it will be looked at.

# Actor input Schema

## `fileUrls` (type: `array`):

Direct links to PDFs or images (PNG, JPG, TIFF, BMP, GIF, WEBP). Google Drive and Dropbox share links work when the file is shared with anyone who has the link. Max 100 MB per file.

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

Languages printed in the documents. Pick only the ones you need: each extra language makes OCR slower and can lower accuracy.

## `ocrMode` (type: `string`):

Auto reads a PDF page's own text layer when it has one and runs OCR only on pages that don't. Images are always OCR'd.

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

Resolution used to render PDF pages before OCR. 300 suits most scans; raise it for very small print.

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

Pages beyond this number are skipped and not charged.

## Actor input object example

```json
{
  "fileUrls": [
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif",
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "languages": [
    "eng"
  ],
  "ocrMode": "auto",
  "dpi": 300,
  "maxPagesPerFile": 200
}
```

# Actor output Schema

## `pages` (type: `string`):

One row per page with the extracted text, the method used (ocr, text-layer or blank), OCR confidence and a needsReview flag. Files that fail get a single row with an error.

# 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 = {
    "fileUrls": [
        "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif",
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidysheets/scanned-pdf-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 = { "fileUrls": [
        "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif",
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("tidysheets/scanned-pdf-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 '{
  "fileUrls": [
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif",
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ]
}' |
apify call tidysheets/scanned-pdf-ocr --silent --output-dataset

```

## MCP server setup

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