# Image and PDF OCR to Text (`daddyd-prints/image-pdf-ocr-text`) Actor

Reads the text in images and PDF pages from public URLs with OCR. Returns the text, a confidence score and every line with its position. Pay per image or PDF page read. Failed files are listed, not charged.

- **URL**: https://apify.com/daddyd-prints/image-pdf-ocr-text.md
- **Developed by:** [Derek Derringer](https://apify.com/daddyd-prints) (community)
- **Stats:** 2 total users, 1 monthly users, 85.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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

## Image and PDF OCR to Text

### What it does

This Actor reads the text in images and PDF pages with OCR (optical character recognition). Give it the web address of one file or a list of them. For each image, and for each page of each PDF, you get the text, one line per line, plus a confidence score from 0 to 1 and every line with its own score and its position on the page.

It reads PNG, JPEG, GIF, BMP, TIFF and WebP images, and PDFs, including scanned PDFs with no text layer. The file type is read from the file itself, not from its name.

It reads each site's robots.txt before anything else and obeys it. It never logs in, never sends a cookie and never tries to get past a CAPTCHA.

### How to use it

1. Open the Actor in Apify Console.
2. Put one web address per line in **Image or PDF URLs**. Files you upload in Console work too.
3. Set **Maximum pages per PDF** if your PDFs are long.
4. Click **Start**.
5. When the run ends, open the **Output** tab. The **Text** view shows the text and confidence for each image or page. Export as CSV, JSON or Excel.

### Input

| Field | What it does | Default | Limits |
| --- | --- | --- | --- |
| Image or PDF URLs (`fileUrls`) | The files to read, one address per line. | None. Prefilled with one public sample image | http and https only. Duplicates are removed |
| Maximum files (`maxFiles`) | The most files this run reads. | 50 | 1 to 1,000 |
| Maximum pages per PDF (`maxPdfPages`) | The most pages read from each PDF, from page 1. | 10 | 1 to 200 |
| Maximum file size (`maxFileSizeMb`) | Larger files are not downloaded. | 20 MB | 1 to 50 MB |
| Download timeout (`requestTimeoutSecs`) | How long a server may take to start answering. The whole download may take up to four times this. | 30 seconds | 5 to 120 seconds |

### Output

One dataset item per image, and one per PDF page read:

| Field | What it holds |
| --- | --- |
| `sourceUrl`, `finalUrl` | The address you gave, and where the file came from after any redirects |
| `fileType` | application/pdf, image/png, image/jpeg, image/gif, image/bmp, image/tiff or image/webp |
| `pageNumber`, `pageCount` | The PDF page from 1, and the pages in the PDF. For an image, empty and 1 |
| `text` | All the text read, one line per line, top to bottom |
| `confidence` | 0 to 1: the average line score, weighted by line length. Empty when no text was found |
| `textFound`, `lineCount`, `characterCount` | Whether any text was found, and how much |
| `lines` | Every line: its text, its confidence, and its box as four \[x, y] corners in pixels |
| `imageWidth`, `imageHeight` | The size of the image that was read |
| `ocrMs`, `processedAt` | How long the OCR took, and when |
| `note` | Set when only the first frame of an animated or multi-page image was read |

Example row from a local test run, a two-line PNG:

```json
{"fileType": "image/png", "pageNumber": null, "pageCount": 1, "text": "Invoice 2026 for Daddy D Prints\nTotal due: 42.50 USD", "confidence": 0.9998, "textFound": true, "lineCount": 2}
```

An image or page with no readable text still gives a row, with `textFound` false and an empty `text`.

### How the text is read

The OCR engine is RapidOCR on ONNX Runtime, with the PP-OCRv6 small models that ship inside the package. Nothing is downloaded while the Actor runs, and your files are not sent anywhere else. PDF pages are drawn at up to 144 dpi and then read like images. Text is found on the image scaled to at most 1,280 pixels on its longest side, which keeps a run inside 512 MB; ordinary 10 to 11 point document text on a full page reads correctly at that size. The models are trained mainly on Chinese and English printed text. Handwriting and very small print read less reliably, and the confidence score shows it.

### Pricing

This Actor is priced per event, with two charges:

- **Actor start:** Apify's automatic start event, $0.0001 per start (one event per GB of run memory, minimum one).
- **Page read:** one charge for each image or PDF page written to the dataset.

**Price per image or PDF page: $3.00 per 1,000, which is $0.003 each.**

These are never charged: files that could not be downloaded (robots.txt blocks, timeouts, errors, 401, 403, 429, login and CAPTCHA pages), files that are not an image or a PDF, damaged files, files over the size limit, PDF pages past **Maximum pages per PDF**, and the REPORT and SKIPPED records.

If you set a maximum cost for the run and it is reached, the Actor reads no more pages, lists the rest in SKIPPED as `spending_limit_reached`, and ends the run without an error.

### Records

| Record | What it holds |
| --- | --- |
| REPORT | Why the run stopped, the settings used, files and pages read, file types, average confidence, pages with no text, skipped by reason, robots.txt results and requests per site |
| SKIPPED | Every file or PDF page that was not read, with the reason |

### Rules it follows

- robots.txt is read first on every site, including every site a redirect leads to, and obeyed.
- One request at a time to any one site, with the site's Crawl-delay. A Crawl-delay over 30 seconds skips the site.
- On Apify, private and local network addresses are refused.
- There is no cookie, header, login, proxy or user agent input. The user agent starts with `image-pdf-ocr-text/0.1`.

### Your responsibility

You are responsible for having the right to read the files you give this Actor and for following each website's terms of use. The text read from a file is yours to handle; the Actor keeps it only in your run's storage.

### Limits

| Limit | Value |
| --- | --- |
| Files per run | 1 to 1,000 |
| Pages per PDF | 1 to 200 |
| File size | 1 to 50 MB |
| Image size | Up to 100 million pixels; larger images are scaled down to 4,000 pixels on the longest side before reading |
| Password-protected or damaged PDFs | Skipped, listed in SKIPPED |
| Memory | 512 MB by default |

# Actor input Schema

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

One web address per line, of an image (PNG, JPEG, GIF, BMP, TIFF or WebP) or a PDF. One address or many. The file type is read from the file itself, not its name. Before anything is requested from a site, the Actor reads that site's robots.txt, and any address it disallows is skipped, listed in SKIPPED and not charged. Files you upload in Console work too.

## `maxFiles` (type: `integer`):

The most files this run will read. Addresses beyond this number are listed in SKIPPED and not charged.

## `maxPdfPages` (type: `integer`):

The most pages read from each PDF, from the first page. The rest are listed in SKIPPED and not charged.

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

Larger files are not downloaded. They are listed in SKIPPED and not charged.

## `requestTimeoutSecs` (type: `integer`):

How long the server may take to start answering. The whole download may take up to four times this. A file that does not arrive in time is listed in SKIPPED and not charged.

## Actor input object example

```json
{
  "fileUrls": [
    "https://tesseract.projectnaptha.com/img/eng_bw.png"
  ],
  "maxFiles": 50,
  "maxPdfPages": 10,
  "maxFileSizeMb": 20,
  "requestTimeoutSecs": 30
}
```

# Actor output Schema

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

No description

## `report` (type: `string`):

No description

## `skipped` (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 = {
    "fileUrls": [
        "https://tesseract.projectnaptha.com/img/eng_bw.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("daddyd-prints/image-pdf-ocr-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 = { "fileUrls": ["https://tesseract.projectnaptha.com/img/eng_bw.png"] }

# Run the Actor and wait for it to finish
run = client.actor("daddyd-prints/image-pdf-ocr-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 '{
  "fileUrls": [
    "https://tesseract.projectnaptha.com/img/eng_bw.png"
  ]
}' |
apify call daddyd-prints/image-pdf-ocr-text --silent --output-dataset

```

## MCP server setup

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