# PDF to Markdown & Text with OCR - Word, PowerPoint, RAG Chunks (`tedock/doc-to-markdown`) Actor

Convert PDF, scanned PDFs, Word (DOCX), PowerPoint (PPTX) and images of text to clean Markdown for AI and RAG. Keeps headings, lists and tables, adds page-numbered chunks with token counts. Direct, arXiv, Google Docs/Slides, Drive and Dropbox links. $0.003 per document; scanned pages $0.005 (OCR).

- **URL**: https://apify.com/tedock/doc-to-markdown.md
- **Developed by:** [Tyler Bunn](https://apify.com/tedock) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.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/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 Markdown & Text with OCR: PDF, Word and PowerPoint for AI and RAG

Turns PDF (including scanned PDFs), Word and PowerPoint files into clean Markdown that **keeps headings, lists and simple tables**, ready for AI and search. Complex tables (merged header cells, multi-line cells, tables full of footnote marks) can come out misaligned. Priced at **$0.003 per document ($3 per 1,000 documents)**, up to 100 pages each, with no start fee. You are charged only for files that convert.

Works with direct file links, **arXiv paper pages** (the PDF is fetched for you), **Google Docs and Google Slides links**, and **Google Drive / Dropbox share links** set to "Anyone with the link".

**Scanned PDFs and photos of pages work too.** Scanned pages (no text layer, or only a stamp such as a page number over a scanned image), and image files (PNG, JPEG, BMP, WebP), are read with OCR for **$0.005 per scanned page** with readable text. Blank or unreadable pages are free.

```json
{
  "status": "success",
  "format": "pdf",
  "pageCount": 15,
  "tables": 10,
  "markdown": "# Attention Is All You Need\n\n## Abstract\n\nThe dominant sequence transduction models...",
  "chunks": [{ "text": "## 3 Model Architecture ...", "tokens": 388, "headings": ["3 Model Architecture"], "pageStart": 3, "pageEnd": 3 }]
}
```

### What you get

For each file, one dataset row (or one row per chunk, if you choose "One row per chunk"; those rows have `chunkIndex`, `text`, `tokens`, `sectionPath`, `pageStart`, `pageEnd`):

| Field | Meaning |
|---|---|
| `markdown` | The full document as Markdown (also saved as a `.md` file, link in `markdownUrl`) |
| `chunks[]` | `text`, `tokens`, `headings` (the section path), `pageStart`, `pageEnd` |
| `pageCount`, `billedDocuments`, `tables`, `headings` | Document stats |
| `estimatedTokens` | Estimated, about 4 characters per token. Not exact for any one model |
| `warnings` | Anything skipped or estimated |
| `status` | `success`, `failed` or `skipped` (with a plain-language `error`) |

Chunks follow your headings, keep each table whole (or split by rows with the header repeated), and never
mix two sections.

### Use cases

- **RAG and vector databases**: turn manuals, policies and reports into chunks with page numbers, ready to embed. Pick "One row per chunk" and load the dataset straight in.
- **Feeding documents to an AI model or agent**: clean Markdown uses far fewer tokens than raw PDF text and keeps the structure the model needs.
- **Research papers**: get headings, sections and tables from arXiv-style PDFs in seconds.
- **Slide decks and Word files**: pull titles, bullets, tables and speaker notes out of PPTX and DOCX in one pass.
- **Bulk conversion**: give it a list of links and it converts several files at once, skipping duplicates.

### FAQ

**How much will a run cost?** Every file that converts costs $0.003, whether it has 1 page or 100. Very long files count as one document per 100 pages (a 250-page book costs $0.009). 1,000 normal PDFs cost $3.00. Failed files cost nothing.

**Does it handle scanned PDFs?** Yes. Pages with no text layer are read with OCR (Tesseract, English) at $0.005 per page that has readable text. Blank pages, photos without text and unreadable scans are free. Turn off "Read scanned pages (OCR)" to skip scanned pages at no cost.

**Can I send a photo or screenshot of a page?** Yes. PNG, JPEG, BMP and WebP images are read with OCR: the document price plus one scanned page.

**Can I upload a file instead of a link?** Share it from Google Drive or Dropbox with "Anyone with the link" and paste that link. Google Docs and Slides links work too: they are exported to Word / PowerPoint and converted.

**Does it work on arXiv links?** Yes. Paste the abstract page (arxiv.org/abs/...) or the PDF link.

**Which AI tools can use it?** Any tool that calls Apify, including AI agents through Apify's MCP server. The output fields are stable and every failed file has a plain-language `error`.

**How fast is it?** A 15-page paper takes a few seconds.

### Supported files

- **PDF** with a text layer: headings by font size, bullet and numbered lists, tables (found by column
  alignment), two-column pages read left column first, repeated headers/footers and page numbers removed.
- **DOCX**: headings, lists, tables (merged cells), image alt text.
- **PPTX**: slide titles, nested bullets, tables, speaker notes (optional), image alt text.

The file type is detected from the file's contents, not its name.

### Pricing

You pay **$0.003 per document converted** (PDF, Word or PowerPoint), for files up to 100 pages. Longer files count as one document per started 100 pages (101-200 pages = $0.006). There is no start fee.
**Scanned pages** (no text layer) and **images** are read with OCR for **$0.005 per page** with readable text, on top of the document price.
For example, a 10-page scanned contract costs $0.003 + 10 x $0.005 = $0.053.
You are only charged for files that convert successfully. Failed downloads,
corrupt files, unsupported files and blank or unreadable scans are free. Set "Maximum cost per run" to cap spending:
the Actor stops before going over it.

### Limits and honest caveats

- **OCR (scanned pages and images) reads English text as plain paragraphs.** Tables in scans come out as lines of text, not Markdown tables, and headings are not detected. Blurry scans can misread numbers and names. At most 50 scanned pages per file by default ("Max scanned pages per file"). Extremely dense small print can be too slow to read: such a page is skipped and free. TIFF files are not supported (save as PDF or PNG).
- Tables are found from text positions. Simple tables with aligned rows work well. Complex ones (merged header cells, multi-line cells, raised footnote numbers, tables drawn without aligned text) can come out misaligned, split in pieces, or as plain text. Check important tables. Headings come from font size, so a heading in body-size bold is not detected.
- Old `.doc` / `.ppt` and Excel files are not supported. Password-protected PDFs fail.
- Links must be publicly reachable. Local and private-network addresses are blocked.
- If 10 files in a row fail, the run stops early and the remaining links are marked as skipped (free). Check the links and run again.
- Only convert documents you have the right to use.

### Input

`urls` (required), `outputMode`, `chunkTokens` (default 500, 0 for none), `chunkOverlapTokens`, `includePageMarkers`,
`includeSpeakerNotes`, `maxPagesPerFile` (300), `maxFileSizeMb` (50), `concurrency` (3).

### Example

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

# Actor input Schema

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

List of links to the files to convert, each as {"url": "https://..."} (plain strings also work). Accepts PDF (including scanned PDFs), DOCX, PPTX and images of text (PNG, JPEG, BMP, WebP); the type is detected from the file contents, so the link does not need an extension. Also accepted: arXiv abstract pages (arxiv.org/abs/...), public Google Docs and Google Slides links (exported to DOCX / PPTX), and Google Drive or Dropbox share links set to "Anyone with the link". Links must be public (no login). Private or local addresses are rejected. Duplicate links are converted once. Example: \[{"url": "https://arxiv.org/pdf/1706.03762"}]. Empty or invalid lists make the run fail.

## `outputMode` (type: `string`):

Choose the shape of the dataset. 'documents' gives one row per file with the full Markdown plus its chunks (best for reading or storing documents). 'chunks' gives one row per chunk with text, tokens, section path and page numbers (best for loading into a vector database). Default: documents.

## `chunkTokens` (type: `integer`):

Maximum size of each chunk, in estimated tokens (about 4 characters per token; not exact for any one model). Chunks follow headings, keep each table whole where it fits, and never mix two sections. Use 300-500 for search/RAG, 1000-2000 for long-context models. 0 skips chunking (ignored when outputMode is 'chunks', which uses 500). Default: 500.

## `chunkOverlapTokens` (type: `integer`):

Tokens repeated from the end of one chunk at the start of the next, so context is not lost at the boundary. 0 means no overlap. Try 30-80 for search. Default: 0.

## `includePageMarkers` (type: `boolean`):

If true, the Markdown contains  comments between pages (PDF and PPTX). Chunks always carry pageStart and pageEnd for citations whether this is on or off. Default: false.

## `includeSpeakerNotes` (type: `boolean`):

PPTX only. If true, each slide's speaker notes are added under the slide as a quote starting with 'Speaker notes:'. Default: true.

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

Only the first N pages (PDF pages, PPTX slides, or about 500 words per DOCX page) of each file are converted. Skipped pages are not charged. Default: 300.

## `ocrScannedPages` (type: `boolean`):

Reads scanned PDF pages (images of text with no text layer) and image files (PNG, JPEG, BMP, WebP) with OCR. Each scanned page that has readable text costs $0.005 on top of the document price; blank or unreadable pages are free. On by default so scanned files work out of the box. Turn off to skip scanned pages for free.

## `maxOcrPagesPerFile` (type: `integer`):

Reads at most this many scanned pages in each file, so one long scanned book can't use up your budget. Pages over the limit are skipped and not charged. Default: 50.

## `maxFileSizeMb` (type: `integer`):

Files larger than this are rejected before conversion and are not charged. Default: 50.

## `concurrency` (type: `integer`):

How many files are downloaded and converted at the same time. Raise for many small files; lower for very large PDFs. Default: 3.

## `expectedText` (type: `string`):

Optional check. If set, the run fails unless at least one converted file's Markdown contains this text. Used for scheduled self-tests; leave empty for normal use.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://arxiv.org/pdf/1706.03762"
    }
  ],
  "outputMode": "documents",
  "chunkTokens": 500,
  "chunkOverlapTokens": 0,
  "includePageMarkers": false,
  "includeSpeakerNotes": true,
  "maxPagesPerFile": 300,
  "ocrScannedPages": true,
  "maxOcrPagesPerFile": 50,
  "maxFileSizeMb": 50,
  "concurrency": 3
}
```

# Actor output Schema

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

One row per file (or per chunk) with Markdown, chunks and page numbers.

## `markdownFiles` (type: `string`):

The full Markdown of each converted file, one .md file per document.

## `summary` (type: `string`):

Counts of files, pages billed and estimated cost.

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

// Run the Actor and wait for it to finish
const run = await client.actor("tedock/doc-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://arxiv.org/pdf/1706.03762" }] }

# Run the Actor and wait for it to finish
run = client.actor("tedock/doc-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://arxiv.org/pdf/1706.03762"
    }
  ]
}' |
apify call tedock/doc-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tedock/doc-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/rSN3hVanIVg0Jgtwp/builds/h6of5qdeoGInSne94/openapi.json
