# PDF to Text with OCR (German & English) (`veedel_digital/pdf-to-text`) Actor

Extract text from PDF files in bulk. Scanned pages are detected automatically and read with OCR (German, English, French, Spanish, Italian). Pay per PDF, OCR only when needed.

- **URL**: https://apify.com/veedel_digital/pdf-to-text.md
- **Developed by:** [Tim Tonat](https://apify.com/veedel_digital) (community)
- **Categories:** Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 pdfs

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

### What does PDF to Text with OCR do?

This Actor **extracts text from PDF files in bulk**. Give it a list of PDF links and get clean text back, as one row per PDF and optionally page by page.

**Scanned PDFs are handled automatically**: pages without a text layer are detected and read with **OCR (Tesseract)** in **German, English, French, Spanish or Italian**. Digital PDFs are read directly from the text layer, which is fast and exact. You only pay for OCR on pages that actually need it.

### Why use this PDF text extractor?

- **Invoices, contracts, reports, letters**: turn PDFs into searchable, machine-readable text
- **Feed LLMs and RAG pipelines** with clean text, page by page
- **Mixed documents** with digital and scanned pages in one file are no problem
- **Strong German OCR**: umlauts and ß included, ideal for documents from Germany, Austria and Switzerland
- **Pay only for results**: PDFs that fail to download are free
- Run it from the Apify API, Make, Zapier or n8n, or schedule it

### What data does it return?

| Field | Description |
|---|---|
| `text` | Full text of the PDF, pages separated by a blank line |
| `pages` | Array with `page`, `text` and `ocr` (true if the page was read with OCR) |
| `pageCount` | Total number of pages in the PDF |
| `pagesProcessed` | Pages processed (see *Max pages per PDF*) |
| `ocrPages` | Page numbers that needed OCR |
| `charCount` | Length of the extracted text |
| `textUrl` | Only for very large texts (over 4 million characters): link to the full text file. `text` and `pages` are then empty |
| `error` | Reason if the PDF could not be processed |

### How to extract text from PDFs

1. Click **Try for free**.
2. Paste direct links to your PDF files into **PDF URLs**.
3. Pick the **OCR languages** of your scanned documents.
4. Click **Start**.
5. Download the results as JSON, CSV, Excel or HTML.

### How much does it cost to convert PDF to text?

This Actor uses **pay per event**, and **platform usage is included**:

- a fixed price **per processed PDF** (any number of text pages)
- plus a price **per OCR page**, charged only for scanned pages

The current prices are shown in the **Pricing** tab. Set **OCR mode** to *Never* if you only need the text layer and want to avoid OCR charges.

### Input

See the **Input** tab for all options.

```json
{
    "pdfUrls": ["https://example.com/files/invoice-2026-001.pdf"],
    "ocrMode": "auto",
    "ocrLanguages": ["deu", "eng"],
    "maxPagesPerPdf": 0,
    "includePages": true
}
```

### Output

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

```json
{
    "url": "https://example.com/files/invoice-2026-001.pdf",
    "fileName": "invoice-2026-001.pdf",
    "pageCount": 2,
    "pagesProcessed": 2,
    "ocrPages": [2],
    "charCount": 1840,
    "text": "Invoice No. 2026-001\nDate: 14.10.2026 ...",
    "pages": [
        { "page": 1, "text": "Invoice No. 2026-001 ...", "ocr": false },
        { "page": 2, "text": "Terms and conditions ...", "ocr": true }
    ],
    "error": null
}
```

### Related Actors

- [PageSpeed Insights & Core Web Vitals Bulk Audit](https://apify.com/veedel_digital/pagespeed-audit): Lighthouse scores and real-user Core Web Vitals for many URLs
- [SEO Site Audit & Broken Link Checker](https://apify.com/veedel_digital/seo-audit): crawl a whole website and find on-page SEO issues and broken pages
- [Structured Data, Schema.org & Open Graph Extractor](https://apify.com/veedel_digital/structured-data): extract JSON-LD, schema.org types and Open Graph tags from many pages

### FAQ

#### Which PDFs are supported?

Any PDF reachable by a direct public link, up to 50 MB. Password-protected PDFs and pages behind a login are not supported.

#### How good is the OCR?

Tesseract works very well on clean scans and printed text at normal resolution. Handwriting, photos taken at an angle and very low-resolution scans give weaker results. Choosing only the languages actually used in the document improves accuracy.

#### Does it keep tables and layout?

The text keeps line breaks and reading order of each page. Table cells are returned as text lines, not as structured table data.

#### Something does not work

Please open an issue in the **Issues** tab with the PDF link and the run ID. You can also start the Actor programmatically from the **API** tab.

# Actor input Schema

## `pdfUrls` (type: `array`):

Direct links to PDF files (max. 50 MB each).

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

auto: OCR only pages without a text layer (scans). always: OCR every page. never: text layer only, no OCR charges.

## `ocrLanguages` (type: `array`):

Languages of the scanned documents. Fewer languages = better accuracy.

## `maxPagesPerPdf` (type: `integer`):

Only process the first N pages of each PDF. 0 = all pages.

## `includePages` (type: `boolean`):

Add a 'pages' array with the text of every page in addition to the full text.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "ocrMode": "auto",
  "ocrLanguages": [
    "deu",
    "eng"
  ],
  "maxPagesPerPdf": 0,
  "includePages": true
}
```

# Actor output Schema

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

Dataset with the text of all PDFs

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

```

## MCP server setup

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