# OCR PDF Extractor: Image to Text, PDF to Markdown & Tables (`manageable_gully/pdf-ocr-extractor`) Actor

Extract text and tables from PDFs and images: PDF to text or Markdown, image to text OCR for scans (Tesseract), 13 languages including Hebrew and Arabic (RTL). Uses the PDF text layer when present, so you pay OCR prices only for scanned pages.

- **URL**: https://apify.com/manageable_gully/pdf-ocr-extractor.md
- **Developed by:** [WebIntel Tools](https://apify.com/manageable_gully) (community)
- **Categories:** AI, Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.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 PDF Extractor: PDF to Text, Image to Text & PDF to Markdown (Hebrew, Arabic + 11 languages)

Turn PDFs and images into clean **Markdown or plain text**, with tables. Digital PDF pages are read straight from the text layer (fast, exact, cheap). Only **scanned pages go through OCR** (Tesseract 5). It handles **right-to-left Hebrew and Arabic** properly, including PDFs whose Hebrew text layer is stored backwards.

### What you can use it for

- **RAG and LLM pipelines:** turn PDFs into clean Markdown with tables, ready for chunking and embeddings.
- **Document processing:** extract text from scanned contracts, invoices and letters (image to text OCR) into JSON.
- **Hebrew and Arabic documents:** get readable right-to-left text, including PDFs whose Hebrew text layer is stored backwards.
- **Data entry automation:** pull tables out of digital PDF reports as rows you can load into a spreadsheet.
- **Archives:** batch-convert hundreds of PDFs or TIFF scans into searchable text.

### How to use it

1. Add PDF or image URLs under **File URLs** (or upload files to an Apify key-value store and paste the record URLs).
2. Pick the OCR **languages**, e.g. `eng` + `heb`.
3. Keep **mode** on `auto`: the text layer is used where it exists and OCR only where it doesn't.
4. Click **Start** and download Markdown, text or JSON.

### Why this one

- **Hybrid extraction:** text layer first, OCR fallback page by page. You pay the OCR price only for scanned pages.
- **RTL done right:** Hebrew and Arabic come out in readable (logical) order, and reversed "visual order" Hebrew text layers are detected and fixed.
- **Tables:** tables in digital PDFs are returned as rows and as Markdown tables, ready for LLM/RAG pipelines.
- **13 OCR languages:** English, Hebrew, Arabic, Russian, German, French, Spanish, Italian, Portuguese, Dutch, Polish, Turkish, Ukrainian. Combine them, e.g. `["heb","eng"]`.
- Formats: PDF, PNG, JPEG, TIFF (multi-page), GIF, BMP, WebP. Up to 50 MB per file.

### Input

```json
{
  "fileUrls": [{"url": "https://example.com/contract.pdf"}],
  "languages": ["eng", "heb"], "mode": "auto", "outputFormat": "markdown", "extractTables": true
}
```

- `mode`: `auto` (recommended), `ocr` (force OCR on every page) or `text` (never OCR).
- `maxPagesPerFile` (default 200), `ocrDpi` (default 300), `includePageDetails` (default true).
- Have local files? Upload them to an Apify key-value store and pass the record URLs.

### Output (one item per file)

```json
{
  "url": "https://example.com/contract.pdf", "pageCount": 12, "ocrPages": 3, "textLayerPages": 9, "tableCount": 2,
  "content": "<!-- page 1 (text) -->\n\nQuarterly Report 2026 ...\n\n| Region | Q2 | Q3 |\n|---|---|---|\n| North | 120 | 150 |",
  "pages": [{"page": 1, "method": "text", "text": "...", "tables": [[["Region","Q2","Q3"],["North","120","150"]]], "ocrConfidence": null}]
}
```

### Good to know

- Processing happens inside the run. Files are not kept beyond the run's default storage retention.
- OCR accuracy depends on scan quality. `ocrConfidence` (0–100) per page helps you spot pages to re-check.
- Handwriting recognition is not supported.

### Pricing

Pay per event, no monthly rent:

- **$0.001 per text-layer page** (digital PDFs)
- **$0.006 per OCR page** (scans and images)
- $0.002 per run start

| Example | Cost |
|---|---|
| A 10-page digital PDF | $0.012 |
| A 10-page scanned PDF | $0.062 |
| 1,000 digital pages | $1.00 |
| 1,000 scanned pages | $6.00 |

Failed downloads and unsupported files are not charged.

You can set a **maximum cost per run** in the run options; the Actor stops cleanly when it is reached. New to Apify? The free plan includes $5 of platform credit every month, so you can try this Actor at no cost.

### API, integrations and AI agents (MCP)

Run it from your own code with the [Apify API](https://docs.apify.com/api/v2) and get the results in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/manageable_gully~pdf-ocr-extractor/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" -d @input.json
```

```python
from apify_client import ApifyClient
run = ApifyClient("<YOUR_APIFY_TOKEN>").actor("manageable_gully/pdf-ocr-extractor").call(run_input={...})
```

- **No-code:** use the Apify app in **n8n, Make or Zapier** ("Run Actor", then "Get dataset items"), or send results to Google Sheets, Slack or a webhook.
- **AI agents (MCP):** add `https://mcp.apify.com?tools=manageable_gully/pdf-ocr-extractor` to Claude, Cursor, VS Code or any MCP client and the agent can call this Actor as a tool.
- **Schedules:** run it hourly, daily or weekly from Apify Console.

### FAQ

**Does it read handwriting?** No. Tesseract OCR handles printed text. Handwriting is not supported.

**Can I convert a PDF to Markdown for ChatGPT or Claude?** Yes. Set `outputFormat` to `markdown`. Headings, paragraphs and tables are preserved, and each page is marked so you can cite page numbers.

**What image formats are supported?** PNG, JPEG, TIFF (including multi-page), GIF, BMP and WebP, plus PDF. Up to 50 MB per file.

**Can AI agents use it?** Yes. It is available as a tool through the Apify MCP server (`https://mcp.apify.com?tools=manageable_gully/pdf-ocr-extractor`) and the Apify API, and it returns structured JSON that agents can read directly.

### More tools from WebIntel Tools

- [Web Page to Markdown](https://apify.com/manageable_gully/page-to-markdown): clean Markdown and RAG chunks from any URL, for LLMs
- [Website Screenshot & URL to PDF](https://apify.com/manageable_gully/url-to-pdf-screenshot): full-page screenshots and PDFs of URLs or your own HTML
- [RSS Feed Reader & Monitor](https://apify.com/manageable_gully/rss-feed-reader): read and monitor RSS, Atom and JSON feeds, only new items

See [all WebIntel Tools Actors](https://apify.com/manageable_gully).

*Made by WebIntel Tools. This Actor was built and is maintained with AI assistance. Report issues on the Issues tab; they are monitored daily.*

# Actor input Schema

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

Direct links to PDF or image files (PNG, JPEG, TIFF, GIF, BMP, WebP). Max 50 MB each. Tip: upload files to an Apify key-value store and paste their record URLs.

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

Languages present in scanned pages. Pick only what you need; more languages = slower OCR.

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

Auto is best for mixed documents.

## `outputFormat` (type: `string`):

Return extracted content as plain text or as Markdown (Markdown keeps tables).

## `extractTables` (type: `boolean`):

Detect tables in digital PDFs and return them as rows (and Markdown tables).

## `includePageDetails` (type: `boolean`):

Adds a 'pages' array with text, method, tables and OCR confidence per page.

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

Stop after this many pages of each file. Useful to cap cost on very long documents.

## `ocrDpi` (type: `integer`):

Higher = more accurate for small print but slower.

## Actor input object example

```json
{
  "fileUrls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ],
  "languages": [
    "eng"
  ],
  "mode": "auto",
  "outputFormat": "markdown",
  "extractTables": true,
  "includePageDetails": true,
  "maxPagesPerFile": 200,
  "ocrDpi": 300
}
```

# Actor output Schema

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

One item per file: page counts, OCR vs text-layer pages, tables and the extracted Markdown/plain text.

# 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": [
        {
            "url": "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("manageable_gully/pdf-ocr-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 = { "fileUrls": [{ "url": "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("manageable_gully/pdf-ocr-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 '{
  "fileUrls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ]
}' |
apify call manageable_gully/pdf-ocr-extractor --silent --output-dataset

```

## MCP server setup

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