# PDF & Document to Markdown: Text, Tables, OCR for RAG (`goldensky_api/pdf-document-to-markdown`) Actor

Turn PDF, Word, PowerPoint, Excel, EPUB and scanned files into clean Markdown with tables and page citations. OCR runs only on pages with no text. Failed files are free.

- **URL**: https://apify.com/goldensky_api/pdf-document-to-markdown.md
- **Developed by:** [GoldenSky](https://apify.com/goldensky_api) (community)
- **Categories:** AI, Developer tools, Agents
- **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 document converteds

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 & Document to Markdown: Text, Tables, OCR for RAG

**Turn PDF, Word, PowerPoint, Excel, EPUB, HTML and scanned files into clean Markdown, with tables and page citations.** Give it links, get one result per file. Scanned pages are read with OCR automatically, and only the pages that need it. **Failed files are free: you pay only for a file that returns text.**

From $0.003 per document (volume tiers go down to $0.0021). No proxy, no browser, no AI model and no API key needed, so there are no hidden costs on top.

### What you get

- **Markdown** with headings, lists and tables (Word tables, Excel sheets and HTML tables become Markdown tables).
- **Page by page text** with page numbers, for citations in RAG and search. PowerPoint slides, Excel sheets and EPUB chapters are returned as pages. Speaker notes are included.
- **OCR for scans.** A PDF page with no text layer is rendered and read automatically. PNG and JPEG files are read too. English text.
- **Counts:** pages, words, characters, OCR pages, file name and type, final link after redirects.
- **A clear status on every file**, so a batch of 1,000 never hides a failure.

### Price (checked 2026-11-17)

| Actor | Price per PDF | Scanned pages |
|---|---|---|
| **This Actor** | **$0.003** (Free/Bronze), $0.0026 Silver, $0.0021 Gold | **+1 document per 5 OCR pages** (about $0.0006 a page) |
| automation-lab/pdf-text-extractor | $0.00345 (Free) | not offered |
| lergassy/document-text-extractor | $0.0035 + $0.00015 per page | $0.01 per OCR page |
| memo23/pdf-text-extractor | $0.005 | $0.015 per OCR page |
| gochujang/pdf-text-extractor | $0.02 + $0.001 per page | not itemised |

Prices are read from each Actor's Store page and change; check before you compare. A 100-page text PDF costs one document here.

### Failed files are free

You are charged only for a file that produced text. These are always free: the link returns an error (404, 500), the site shows a bot check or refuses the download, the download times out, the file is too big, the file is empty, damaged, password protected, an old binary Office file (.doc, .xls, .ppt) or a file type we do not read, a scan with OCR off, and links we refuse for safety. Each one is a row with a `status` and a `message` saying why.

### Supported files

PDF · Word `.docx` · PowerPoint `.pptx` · Excel `.xlsx` · EPUB · HTML · plain text and Markdown · CSV/TSV · PNG and JPEG (OCR). Links to your own files on Google Drive and Dropbox work (share links are turned into download links). Not supported: old `.doc` / `.xls` / `.ppt` (save them as the new format), password-protected files, handwriting.

### Input

| Field | What it does |
|---|---|
| `urls` | Links to the files (required). |
| `ocr` | `auto` (default) reads scanned pages and images; `off` never runs OCR. |
| `maxOcrPages` | Most OCR pages per file (default 10). |
| `includePages` | Add the page-by-page list (default on). |
| `maxDocuments` | Most files per run (default 100); extra files are skipped, not charged. |
| `maxFileMb` | Largest file (default 30 MB). |
| `timeoutSecs` | Download timeout (default 60). |

```json
{ "urls": [{ "url": "https://arxiv.org/pdf/1706.03762" }], "ocr": "auto" }
```

### Output (one row per file)

```json
{
  "url": "https://arxiv.org/pdf/1706.03762",
  "fileName": "1706.03762",
  "status": "success",
  "format": "pdf",
  "pageCount": 15,
  "wordCount": 6200,
  "ocrPages": 0,
  "markdown": "Attention Is All You Need ...",
  "pages": [{ "pageNumber": 1, "text": "..." }],
  "charged": true,
  "units": 1
}
```

`status` is one of `success`, `http_error`, `blocked`, `timeout`, `too_large`, `unsupported_format`, `unreadable`, `no_text`, `refused`, `skipped`, `error`. Only `success` is charged. If no file in a run produces text, the run itself is marked failed, so you notice it.

### For AI agents and MCP

Call this Actor from Claude, Cursor or any MCP client through Apify's MCP server (`actors/<this-actor>`). Pass `urls`; read `markdown` for the whole document or `pages[].text` with `pageNumber` to cite the page. Check `status` before using `markdown`. It never calls a model, so results are the same every time.

### Good to know

- PDF tables are returned as text lines in reading order, not rebuilt as Markdown tables. Word, Excel and HTML tables are real Markdown tables.
- Text is returned as the file stores it. A PDF made of scanned images with OCR off returns `no_text` and is free.
- We never get around a bot check or CAPTCHA, never log in, and refuse links to private networks, social networks, video platforms, search-result pages and AI chat apps. Your files are processed inside your own run and nothing is kept.
- OCR is English only in this version.

### Use cases

PDF to text for RAG pipelines and LLM context · invoices and receipts to text · contracts and reports to Markdown · PowerPoint and Word to text for search indexes · Excel to Markdown tables · EPUB to text · bulk document conversion by link.

# Changelog

This Actor's version history is a separate document: https://apify.com/goldensky_api/pdf-document-to-markdown/changelog.md

# Actor input Schema

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

Public http(s) links to PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx), EPUB, HTML, text, CSV or PNG/JPEG files. Google Drive and Dropbox share links to your own files work. Addresses on private networks, social networks, video platforms, search-result pages and AI chat apps are refused.

## `ocr` (type: `string`):

Auto reads pages that have no text layer, and image files, with OCR (English). Off never runs OCR: scanned pages are skipped and a file with nothing else comes back as a free 'no_text' row.

## `maxOcrPages` (type: `integer`):

Limits OCR work (and cost) on long scans. Pages past the limit are skipped and the row says so.

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

Adds a pages list (page number and text) to each result, for citations. PowerPoint slides, Excel sheets and EPUB chapters count as pages.

## `maxDocuments` (type: `integer`):

Extra files are skipped and not charged.

## `maxFileMb` (type: `integer`):

Bigger files are skipped and not charged.

## `timeoutSecs` (type: `integer`):

How long to wait for one file to download.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    },
    {
      "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
    }
  ],
  "ocr": "auto",
  "maxOcrPages": 10,
  "includePages": true,
  "maxDocuments": 100,
  "maxFileMb": 30,
  "timeoutSecs": 60
}
```

# 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": [
        {
            "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
        },
        {
            "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("goldensky_api/pdf-document-to-markdown").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": [
        { "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" },
        { "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("goldensky_api/pdf-document-to-markdown").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": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    },
    {
      "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
    }
  ]
}' |
apify call goldensky_api/pdf-document-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,goldensky_api/pdf-document-to-markdown"
        }
    }
}
```

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/cnbEwqUJEksaQXCUd/builds/BOy2cfT2M4hx9cd3X/openapi.json
