# PDF to Text Extractor - Scanned PDF OCR (`helenisapi/pdf-to-text-extractor-scanned-pdf-ocr`) Actor

Convert 📄 PDF to Text page by page with metadata, OCR for scanned pages & Markdown tables. ✅ Digital or scanned. ⚡ Fast. 📦 No API key.

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

## Pricing

from $0.20 / 1,000 text 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

## 📄 PDF to Text Extractor - Scanned PDF OCR

**Paste PDF links, get their text.** Reports, contracts, papers, invoices, brochures, scanned archives: every PDF becomes **clean text page by page**, with its **metadata**. Scanned pages are read by **AI OCR** automatically, and an **AI mode** gives you **Markdown with headings and tables**, ready for RAG and LLM pipelines.

Works on a plain list of PDF links **or on the dataset of another actor** that found them. No API key, no setup: add links and hit **Run**.

***

### ⚡ Why this actor?

- 🧠 **Smart by default:** the PDF's own text is used when it exists (fast and exact), and only the scanned pages go to the AI.
- 🖨️ **Scanned PDFs too:** image-only pages, faxes and photographed documents, handwriting included. Scans are read at high resolution.
- 📊 **Markdown with tables:** AI mode rebuilds headings, lists and tables, and turns figures into one line of labels instead of noise.
- 📑 **Page by page:** each page is a separate item, with how it was read (`text` or `ai`).
- 🏷️ **Metadata:** title, author, subject, creator, producer, creation and modification dates.
- 🎯 **Page ranges:** extract `1-5,8` instead of the whole document.
- 🔗 **Chains with other actors:** point it at a dataset ID and it extracts the PDFs listed in it.

***

### 🏆 How it compares

| Feature | This actor | Text-layer extractors | Classic OCR |
|---|:---:|:---:|:---:|
| 📄 Digital PDFs | ✅ | ✅ | ⚠️ Slower |
| 🖨️ Scanned pages | ✅ Automatic | ❌ | ✅ |
| ✍️ Handwriting | ✅ | ❌ | ❌ |
| 📊 Tables as Markdown | ✅ AI mode | ❌ | ❌ |
| 💸 Pay only for AI where needed | ✅ | — | ❌ |
| 💸 Failed PDFs charged | ❌ Never | ⚠️ Varies | ⚠️ Varies |

***

### 📊 What data do you get?

One row per PDF. The table view shows the essentials; the full row holds every page.

#### 📄 Document

| Field | Description | Example |
|---|---|---|
| `pdfUrl` | The PDF link you gave | `https://arxiv.org/pdf/1706.03762` |
| `success` | `true` when the PDF was extracted | `true` |
| `error` | `code` and `message` when the PDF could not be extracted (not charged) | — |
| `source` | Final URL of the PDF, after redirects | `https://arxiv.org/pdf/1706.03762` |
| `pageCount` | Pages in the PDF | `15` |
| `pagesExtracted` | Pages you asked for and got | `3` |
| `textPages` | Pages taken from the PDF's own text layer | `0` |
| `aiPages` | Pages read by the AI | `3` |

#### 🏷️ Metadata

| Field | Description | Example |
|---|---|---|
| `title` | Document title, when the PDF declares one | — |
| `author` | Document author, when declared | — |
| `created` | Creation date, ISO 8601 | `2024-04-10T21:11:43+00:00` |
| `metadata` | Everything the PDF declares: `title`, `author`, `subject`, `creator`, `producer`, `created`, `modified` | `"creator": "LaTeX with hyperref"` |

#### 📝 Content

| Field | Description | Example |
|---|---|---|
| `text` | All extracted pages, in order | `Attention Is All You Need\nAshish Vaswani ...` |
| `markdown` | All extracted pages as Markdown, separated by `---`. AI pages keep headings and tables; text-layer pages stay plain text | `## Abstract\n\nThe dominant sequence transduction models ...` |
| `pages` | One item per page: `page`, `method` (`text` or `ai`), `text`, `markdown` (AI pages only) | `{ "page": 1, "method": "ai", ... }` |

***

### 🚀 How to use it

1. Add **direct links** to PDFs (one per line), or a **dataset ID** from another actor.
2. Pick a **mode**: **Auto** (recommended), **Text layer only** (cheapest) or **AI on every page** (best Markdown).
3. Optionally limit the **pages**.
4. Click **Run**, then export the table as CSV, Excel or JSON.

#### ⚙️ Input

| Option | Default | Description |
|---|:---:|---|
| 🔗 **PDF links** | — | One direct link per line, up to 50 MB each |
| 📦 **Dataset ID (optional)** | — | Extract the PDFs listed in an existing Apify dataset |
| **PDF link field in the dataset** | — | Field holding the PDF link. Empty: `pdfUrl`, `fileUrl`, `documentUrl`, `downloadUrl` and `url` are tried |
| **Maximum PDFs** | `0` | Stop after this many PDFs (`0` = no limit) |
| 🧠 **Extraction mode** | Auto (recommended) | **Auto**: the PDF's own text, AI OCR for scanned pages only. **Text layer only**: no AI, cheapest. **AI on every page**: clean Markdown with headings and tables |
| 📑 **Pages (optional)** | All | e.g. `1-5,8,10-12`. 500 pages at most, 100 read by the AI |
| **Parallel PDFs** | `3` | How many PDFs are processed at the same time (1-5) |

Duplicate links are removed before the run starts.

#### Input example

```json
{
  "urls": ["https://arxiv.org/pdf/1706.03762"],
  "maxPdfs": 0,
  "mode": "auto",
  "maxConcurrency": 3
}
```

#### Output example (one row per PDF)

The same paper, run with `"mode": "ai"` and `"pages": "1-3"`:

```json
{
  "pdfUrl": "https://arxiv.org/pdf/1706.03762",
  "success": true,
  "pageCount": 15,
  "pagesExtracted": 3,
  "textPages": 0,
  "aiPages": 3,
  "created": "2024-04-10T21:11:43+00:00",
  "markdown": "Attention Is All You Need\n\nAshish Vaswani ... \n\n## Abstract\n\nThe dominant sequence transduction models ...\n\n---\n\n...",
  "pages": [{ "page": 1, "method": "ai", "text": "...", "markdown": "..." }]
}
```

*Shortened from a real run.*

Available as **JSON**, **CSV**, **Excel**, or via the **Apify API** and **dataset exports**.

#### Limits

PDFs up to **50 MB** and **500 pages**; at most **100 pages read by the AI** per PDF (for longer scanned documents, run page ranges such as `1-100`, then `101-200`). Password-protected PDFs are not supported in this actor.

***

### 💰 Pricing

Pay only for pages you get:

| Event | When |
|---|---|
| 📄 Text page | Each page taken from the PDF's own text layer |
| 🧠 AI page | Each page read by the AI (scanned pages in Auto mode, every page in AI mode) |

Text pages are the cheap ones. In **Auto** mode, a digital PDF is billed as text pages only; the AI price applies only to the pages that need it.

PDFs that cannot be downloaded or opened are listed with their error and **not charged**. Set a maximum cost per run in the run options and the actor stops cleanly when it is reached.

> 🆓 On the Apify **free plan**, each run extracts the first 10 pages of the first 5 PDFs.

***

### 💡 Use cases

- 🤖 **RAG & search:** feed clean, page-numbered text and Markdown to your vector database or LLM.
- 📑 **Document automation:** pull the text of contracts, reports and invoices into your workflows.
- 🗄️ **Archives:** make scanned documents and old faxes searchable.
- 🎓 **Research:** extract papers with their tables and section structure.
- 🔗 **Crawl, then read:** run a crawler that collects PDF links, then pass its dataset ID here.
- 🏷️ **Document inventory:** list the page count, title, author and dates of a batch of PDFs.

***

### ❓ FAQ

**Which mode should I choose?**
Auto for almost everything. Text if you only need raw text from digital PDFs at the lowest price. AI when layout matters: tables, multi-column papers, forms.

**How does Auto mode spot a scanned page?**
A page whose text layer holds fewer than 30 characters is treated as a scan and read by the AI. Every other page keeps its own text.

**How big can a PDF be?**
Up to **50 MB** and **500 pages**, with at most **100 pages read by the AI** per PDF. For a longer scanned document, run page ranges (`1-100`, then `101-200`).

**Can I extract PDFs found by another actor?**
Yes. Paste its **dataset ID**. The actor reads the link from `pdfUrl`, `fileUrl`, `documentUrl`, `downloadUrl` or `url`, or from the field you name.

**Am I charged for PDFs that fail?**
No. A PDF that cannot be downloaded or opened gets a row with `success: false` and its `error`, and costs nothing. Temporary failures are retried once. If no PDF at all could be extracted, the run is marked as failed.

**Why is the text-layer output sometimes oddly spaced?**
That is how the PDF stores its text (common with LaTeX and multi-column layouts). Use AI mode for clean reading order.

**Does it read images and charts?**
Text printed inside figures is kept as one `[Figure: ...]` line in AI mode; images without text are skipped.

**What about password-protected PDFs, Word or PowerPoint files?**
Password-protected PDFs are not supported in this actor. Convert Word and PowerPoint files to PDF first.

***

### 🔌 Integrations

Connect results to your existing workflow:

- 📗 **Google Sheets**: Auto-export results to a spreadsheet
- 🪝 **Webhooks**: Trigger downstream actions when a run completes
- ⚡ **Zapier / Make**: Plug into 1000+ apps
- 🛠️ **API**: Fetch results programmatically from any language
- 🔄 **Scheduled runs**: Re-extract documents that change on a recurring schedule
- 🤖 **AI agents**: call it from Claude, Cursor or any MCP client through Apify's MCP server

***

### 🌐 Also available as an API

The same engine is sold as a REST API on RapidAPI: **PDF to Text - Markdown, Tables & Scanned PDF OCR** by **Helenis API**. It also accepts direct uploads and password-protected PDFs.

***

### 🔒 Privacy

PDFs are downloaded, read and discarded: neither the file nor its text is stored by our backend. The AI sub-processor may keep requests temporarily for abuse monitoring. Only process documents you have the right to process.

# Actor input Schema

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

One direct link per line, up to 50 MB each (e.g. https://arxiv.org/pdf/1706.03762).

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

Extract the PDFs listed in an existing Apify dataset.

## `datasetUrlField` (type: `string`):

Name of the field holding the PDF link. Leave empty to try pdfUrl, fileUrl, documentUrl, downloadUrl and url.

## `maxPdfs` (type: `integer`):

Stop after this many PDFs (0 = no limit).

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

Auto: the PDF's own text, and AI OCR for scanned pages only. Text: the PDF's own text only (cheapest). AI: AI on every page, for clean Markdown with headings and tables.

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

e.g. 1-5,8,10-12. All pages when empty (500 at most; 100 read by the AI).

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

How many PDFs are processed at the same time.

## Actor input object example

```json
{
  "urls": [
    "https://arxiv.org/pdf/1706.03762"
  ],
  "maxPdfs": 0,
  "mode": "auto",
  "maxConcurrency": 3
}
```

# Actor output Schema

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

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

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

```

## MCP server setup

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