# PDF OCR - Scanned PDF to Text & Markdown, Page by Page (`tidytools/pdf-to-text-ocr`) Actor

Convert public scanned PDF links to text or Markdown, one row per page by default. Text-bearing pages cost $0.003 each; blank and failed pages are free. Select page ranges or combine a PDF into one result row.

- **URL**: https://apify.com/tidytools/pdf-to-text-ocr.md
- **Developed by:** [Yukai Lin](https://apify.com/tidytools) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.40 / 1,000 image transcribeds

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 OCR — Scanned PDF to Text & Markdown, Page by Page

### What does this PDF OCR tool do?

Paste a public scanned PDF URL (or a Google Drive, Dropbox or OneDrive share link) and get **one Dataset row per page** with its text or Markdown. This edition targets scanned PDFs and image-only pages for page-by-page OCR through the existing `image-ocr` engine and `image-ocr` billing event. `document-to-markdown` primarily converts text-based documents to Markdown. Each page with text uses one existing `image-ocr` event: **$0.003 per page on the Free plan**. Blank pages and failures are free. The default limit is **50 selected pages per PDF**; you can change it up to 500. PDFs must be **15 MB or less**. Password-protected or oversized PDFs return a free error row. Searchable PDFs also work: their text layer is read directly when available, while scanned pages use OCR. Markdown may keep simple tables, but original page layout is not preserved.

### How to use

1. Click **Start** with the prefilled [three-page scanned sample PDF](https://filedone.ai/sample-files/sample-scanned-report-3-pages.pdf) to see a page-by-page result. The sample is CC0 and contains fictional content. Used alone, the sample runs normally and each text-bearing page is charged. If you keep the prefilled sample and add your own valid URL, image URL list entry, dataset URL or base64 image, the sample is skipped; only your sources produce results and charges. The `SUMMARY` record reports `sampleSkipped:true` and `sampleSkipReason`.
2. Paste one public PDF URL per line in **PDF URLs or shared file links**. Use `pageRange` such as `1-2,5` to read only selected pages. `maxPdfPages` limits how many selected pages are processed per file.
3. Keep **Markdown** for headings and tables, or choose **Plain text**. `mergePdfPages:true` combines the selected pages into one Dataset row with a `pages` array and `chargedPages` count. Export the Dataset as JSON, CSV or Excel.

Image URLs, dataset image fields and base64 images accepted by the underlying image-ocr engine remain supported. A duplicate URL is processed once. Skipping the prefilled sample in a mixed run does not change billing for any other source. A page with no detected text gives `errorType:"no_text"` and `charged:false`.

### Input example

First Start, using the prefilled sample (up to three `image-ocr` events, $0.009 on Free if all pages have text):

```json
{"urls":["https://filedone.ai/sample-files/sample-scanned-report-3-pages.pdf"],"mode":"markdown","maxPdfPages":50,"mergePdfPages":false}
```

To read just page 2, add `"pageRange":"2"`. To get one row for pages 1 and 2, use `"pageRange":"1-2","mergePdfPages":true`.

**Keep form checkboxes in images** (`preserveCheckboxes`, off by default) applies to image URLs only. PDF pages ignore it: they are read and charged as before, without checkbox symbols or `checkboxReview`.

### Output example

Each selected page is a separate row by default. This abbreviated example shows the fields most useful for a PDF; actual OCR wording can vary:

```json
{"pdfUrl":"https://filedone.ai/sample-files/sample-scanned-report-3-pages.pdf","pageNumber":1,"pdfPageCount":3,"text":"# Larkfield Community Library\nAnnual report ...","charCount":47,"success":true,"charged":true,"route":"pdf-ocr"}
```

The **PDF text by page** view shows `pdfUrl`, `pageNumber`, `text`, `charCount`, `charged`, `chargedPages`, `pages`, `errorType` and `imageUrl`. The full Dataset also has `pdfPageCount`, `success`, `route`, `language`, `lineCount`, `error` and other engine fields. In merged mode, the one row has `pages` entries with `pageNumber`, `text`, `success` and optional `errorType`; `chargedPages` is the number of text-bearing pages billed. With no successful page, the top-level `errorType` is `no_text` when all selected pages are blank, or `ocr_unavailable` when any page's OCR backend fails, including mixed blank and failed pages. `imageUrl` contains the source URL for both PDF and image inputs.

### Pricing

| Result | Charge |
|---|---:|
| PDF page with text | One `image-ocr` event, $0.003 on Free |
| Blank page (`no_text`), failed or skipped page | $0 |
| Image with text, when supplied | One `image-ocr` event, $0.003 on Free |

A three-page PDF with two text pages costs **$0.006** on Free. Merging pages changes the number of Dataset rows, not the number of charge events. Higher Apify plans may have volume discounts; check the **Pricing** tab. There is no separate PDF event or start fee.

Before processing, the status and run log show the amount if all sources are single-page images and the true upper limit if every unknown URL is a PDF with up to `maxPdfPages` pages (50 by default). For one URL on Free, these are $0.003 and $0.15; the latter is an upper limit, not the price of one image. `SUMMARY.costPlan.singlePageImageScenarioUsd` and `worstCaseUsd` keep both amounts. The upper limit is compared with your maximum charge per run. Blank image/PDF pages and failed items are free.

### Limitations

**Chinese, Japanese and Korean accuracy:** Review OCR text against the original before relying on names, dates, amounts or other important fields. In a 2026-10-28 local test of the same image OCR engine, one Japanese receipt image had a 32.1% character error rate and one Korean street-sign image had 23.9%; both missed the test's 20% target. These were images, not a benchmark of scanned PDFs or all documents, and no comparable Chinese accuracy figure was measured. Start with a representative page and proofread the result; use a readable text-layer PDF when available. OCR output and `language` labels can be wrong.

- Scanned text, handwriting, small print and irregular tables can be misread. Compare important values with the source. Markdown is extracted text, not a reconstruction of the PDF's original layout.
- A PDF may be up to 15 MB. Password protection, inaccessible share links, missing files and OCR failures yield free error rows. Some hosts block data-center downloads.
- The first 50 selected pages are read by default; the input allows 1–500. Extra pages are skipped without charge. Page numbers are one-based.
- Text-layer pages may be read directly, while image-only pages use page OCR. Either path charges one `image-ocr` event only when that page returns text.

### FAQ

**Can I paste a Drive or Dropbox sharing link?** Yes, for a publicly accessible file. If the link requires login or the host blocks downloads, the result is a free error row.

**Can I get one row per file?** Yes. Set `mergePdfPages:true`; the row includes a `pages` array and `chargedPages`. The default is one row per selected page.

**Are blank pages charged?** No. They return a free `no_text` row. Failed pages and invalid URL lines are free too.

**Does it make a searchable PDF?** No. It returns extracted text or Markdown in a Dataset. It does not modify the source PDF.

### Support

Use the Actor's **Issues** tab with a public sample URL and the failing page number. Do not send private documents.

# Actor input Schema

## `urls` (type: `array`):

Paste public PDF URLs, one per line, or Google Drive, Dropbox and OneDrive share links. A PDF up to 15 MB is read page by page; password-protected files return a free error. The prefilled three-page sample runs and charges normally when used alone. If you keep it and add another valid URL, imageUrls entry, dataset URL, or base64 image, the sample is skipped and only your sources are processed and charged. Image URLs also work. Invalid lines and duplicate URLs are free.

## `imageUrls` (type: `array`):

The same as "Image URLs", in the URL list editor: you can also upload or link a text/CSV file of image links.

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

Plain text keeps line breaks; Markdown keeps tables. Table rows adds columns/rows to Markdown text for complete regular pipe tables; tableReview flags missing or irregular tables. Receipt / invoice fields keep full text and add receipt.vendor/date/total/currency/review from explicit labels; missing or ambiguous values need review. PDFs use same mode. Check against source; fields aren't accounting-grade. Each image or PDF page with text costs one image-ocr event; no-text and failures are free.

## `language` (type: `string`):

Main language of the text, e.g. Japanese, Traditional Chinese, German. Optional: the text is transcribed in its original language either way; a hint can help with small or stylized script.

## `preserveCheckboxes` (type: `boolean`):

Images only: write ☐ (empty), ☑ (check mark) or ☒ (X mark, selected) for a form checkbox with readable label text and a clear state; unclear boxes keep only their label. An answer of only ☐ ☑ ☒, whitespace and Markdown layout is no_text and free (charged with the option off); anything else visible, even a lone X, is charged. Long images read by page OCR get checkboxReview:true. PDFs ignore this option. Event and price unchanged.

## `datasetId` (type: `string`):

Take image URLs from another Actor run's dataset (e.g. a scraper's image field).

## `datasetField` (type: `string`):

Field with the image URL, e.g. "imageUrl", or an array of image URLs such as "images" (up to 100 per item). Empty = the first URL field found.

## `imagesBase64` (type: `array`):

Images sent as base64 strings, data URLs (data:image/png;base64,...) or objects {"id": "receipt-17", "data": "<base64>"} (the id is returned with the result), for images that are not online. Mainly for API and AI-agent use.

## `maxConcurrency` (type: `integer`):

How many images are transcribed at the same time.

## `proxyConfiguration` (type: `object`):

Only used to download images from sites that block data-center requests. Apify proxy usage is billed to your Apify account.

## `maxSecondsPerImage` (type: `integer`):

An image that is not finished in this time (slow download or a very long text) is reported as failed with errorType "timeout" and is not charged, so one stuck image cannot hold the run. A dense page can need 1-3 minutes. If the first answer is cut off and page OCR fails, a tall image may use up to two extra region reads when time allows; it can still be marked truncated. The limit stays 30-300 seconds and one image with returned text has one image-ocr charge.

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

At most this many selected pages are read from each PDF; extra pages are skipped without charge. Default 50.

## `pageRange` (type: `string`):

One-based PDF pages, such as 1-5,8. Empty reads the first pages up to Maximum PDF pages.

## `mergePdfPages` (type: `boolean`):

Combine selected PDF pages into one dataset row, keeping a pages array and charging one image-ocr event for each page with text. Default is one row per page.

## Actor input object example

```json
{
  "urls": [
    "https://filedone.ai/sample-files/sample-scanned-report-3-pages.pdf"
  ],
  "mode": "markdown",
  "preserveCheckboxes": false,
  "maxConcurrency": 4,
  "maxSecondsPerImage": 180,
  "maxPdfPages": 50,
  "mergePdfPages": false
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

No description

## `full` (type: `string`):

No description

## `details` (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 = {
    "urls": [
        "https://filedone.ai/sample-files/sample-scanned-report-3-pages.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidytools/pdf-to-text-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 = { "urls": ["https://filedone.ai/sample-files/sample-scanned-report-3-pages.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("tidytools/pdf-to-text-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 '{
  "urls": [
    "https://filedone.ai/sample-files/sample-scanned-report-3-pages.pdf"
  ]
}' |
apify call tidytools/pdf-to-text-ocr --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tidytools/pdf-to-text-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/nictrJI3c872MHvUn/builds/MQWJfSKcKHcNJW4t7/openapi.json
