# PDF & Image to Text (OCR) - Extract Text and Tables to Excel (`gosoul9/pdf-image-to-text-ocr`) Actor

Extract text and tables from PDFs (native or scanned) and images (JPG, PNG, TIFF) page by page with OCR in English, French, German, Spanish, Italian, Portuguese. Export to Excel, CSV, JSON. $3 per 1,000 pages.

- **URL**: https://apify.com/gosoul9/pdf-image-to-text-ocr.md
- **Developed by:** [Gosoul Data](https://apify.com/gosoul9) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 page extracteds

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 & Image to Text (OCR) - Extract Text and Tables to Excel

Stop copy-pasting from PDFs. Give this Actor links to **PDFs (native or scanned) or images**, and get back the **text of every page** and the **tables as rows and columns**, ready for Excel, Google Sheets, a database or an AI pipeline.

### What it does

- **Native PDFs** (invoices, reports, catalogues, price lists): fast text extraction + **table detection**.
- **Scanned PDFs, photos, screenshots** (JPG, PNG, TIFF, WEBP): **OCR** (optical character recognition) with Tesseract.
- **Auto mode**: OCR is used only on pages that have no real text, so mixed documents work out of the box.
- Languages: English, French, German, Spanish, Italian, Portuguese (combine them: `eng+fra`).

### Output (one item per page)

| Field | Example |
|---|---|
| `fileName`, `fileUrl` | `price-list-2026.pdf` |
| `page`, `totalPages` | `3`, `12` |
| `method` | `text` or `ocr` |
| `text` | Full page text |
| `tables` | `[["Product", "Price"], ["Widget A", "12.50"]]` |
| `wordCount`, `tableCount` | `412`, `1` |

### Use cases

- **Supplier catalogues & price lists** → product spreadsheet.
- **Invoices, receipts, purchase orders** → accounting data.
- **Contact lists in PDF** (member directories, exhibitor lists) → leads spreadsheet.
- **Scanned archives** → searchable text.
- **AI / RAG pipelines**: clean page-by-page text to feed ChatGPT or a vector database.

### Input example

```json
{
  "fileUrls": ["https://example.com/catalogue.pdf", "https://example.com/scan.jpg"],
  "ocrLanguages": "eng+fra",
  "ocrMode": "auto",
  "extractTables": true,
  "maxPagesPerFile": 100
}
```

Files must be reachable by a public URL (or a signed link from Google Drive, Dropbox, S3...).

### Pricing

**$3 per 1,000 pages.** Files that fail to download are free.

### Good to know

- OCR quality depends on scan quality: 300 dpi scans give the best results.
- Table detection works on native (text) PDFs. For scanned tables, the text is returned line by line.
- Max 50 MB per file.

### Other Actors you may like

- [Website Contact Scraper](https://apify.com/gosoul9/website-contact-scraper): emails, phones and social links from any website.
- [Sitemap URL Extractor](https://apify.com/gosoul9/sitemap-url-extractor): every URL of a website from its sitemaps.
- [EU Public Tenders Scraper](https://apify.com/gosoul9/eu-public-tenders-scraper): public procurement notices from TED.
- [Company Website Finder](https://apify.com/gosoul9/company-website-finder): company name in, official website out.
- [App Store Reviews Scraper](https://apify.com/gosoul9/app-store-reviews-scraper): reviews and ratings of iPhone apps.

### Support

Send an example file in the **Issues** tab if something is not extracted correctly.

# Actor input Schema

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

Direct links to PDF files or images (PNG, JPG, TIFF, WEBP), one per line. Scanned PDFs and photos are read with OCR.

## `ocrLanguages` (type: `string`):

Languages of the documents for OCR: eng, fra, deu, spa, ita, por. Combine with + (e.g. eng+fra).

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

Auto = use OCR only on pages without real text (scans). Always = OCR every page. Never = text layer only (fastest).

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

Detect tables in text PDFs and return them as rows and columns (ready for Excel).

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

Limit the number of pages read in each file.

## Actor input object example

```json
{
  "fileUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "ocrLanguages": "eng",
  "ocrMode": "auto",
  "extractTables": true,
  "maxPagesPerFile": 100
}
```

# Actor output Schema

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

```

## MCP server setup

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