# PDF, Word and PowerPoint to Markdown for LLMs and RAG (`tan-solutions/document-to-markdown`) Actor

Convert PDF, DOCX and PPTX files (by URL or from a key-value store) into clean Markdown and plain text with headings, tables, page numbers and RAG chunks. Pay per converted document; protected, unsupported and failed files are free.

- **URL**: https://apify.com/tan-solutions/document-to-markdown.md
- **Developed by:** [Tan Solutions](https://apify.com/tan-solutions) (community)
- **Categories:** AI, Developer tools, Integrations
- **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 converted documents

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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, Word and PowerPoint to Markdown for LLMs and RAG

Convert PDF, DOCX (Word) and PPTX (PowerPoint) files into clean Markdown and plain text for LLMs and RAG:
headings, lists, tables, page or slide numbers, and ready-made RAG chunks. Give it links to the files, or files you
stored in an Apify key-value store. You pay only for documents that convert; failed, protected, scanned-without-text
and too-large documents are free.

### Run it from the API or on a schedule

Get the Markdown back in one call (replace `<YOUR_API_TOKEN>` with your Apify API token from Console, **Settings**, **API & Integrations**):

```bash
curl -X POST "https://api.apify.com/v2/acts/tan-solutions~document-to-markdown/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"documentUrls":[{"url":"https://www.rfc-editor.org/rfc/rfc9309.pdf"}],"chunkSize":2000}'
```

Send `{}` (no input) to try it on one sample PDF (RFC 9309, 12 pages).

Convert the same documents every Monday at 06:00 UTC with an Apify schedule (`xO93Bu8uBEwWOQxhK` is this Actor's ID):

```bash
curl -X POST "https://api.apify.com/v2/schedules?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"name": "document-to-markdown-weekly", "cronExpression": "0 6 * * 1", "timezone": "UTC", "isEnabled": true, "isExclusive": true,
       "actions": [{"type": "RUN_ACTOR", "actorId": "xO93Bu8uBEwWOQxhK",
         "runInput": {"body": "{\"documentUrls\":[{\"url\":\"https://www.rfc-editor.org/rfc/rfc9309.pdf\"}],\"chunkSize\":2000}", "contentType": "application/json"}}]}'
```

In Apify Console the same is: **Schedules**, **Create new**, cron `0 6 * * 1`, add this Actor with your input.

### What it does

- **PDF**: text in reading order (two-column pages are read column by column), headings from the font sizes, page
  numbers, and the document's title, subject, keywords, producer and dates.
- **Word (DOCX)**: headings, lists and tables. Comments, tracked-change authors and hidden personal metadata are left
  out.
- **PowerPoint (PPTX)**: one section per slide with the slide title, text, tables and speaker notes.
- **HTML, Markdown and plain text** files come back as Markdown too.
- Optional: one entry per page or slide (`pages`), plain text (`text`) and fixed-size chunks with overlap (`chunks`).
- Every document is converted in its own sandbox with a memory and time limit, so one broken file never stops the run.

### Who it is for

- Teams building AI assistants, chatbots and RAG search over reports, manuals, contracts and slide decks.
- Developers who need document text in a pipeline without running their own PDF and Office parsers.
- No-code users of Make, Zapier or n8n who want "file in, Markdown out" through Apify's integrations.

### Quick start

1. Paste one or more links into **Document URLs**, or pick a **Key-value store** and list the **Record keys** of files
   you uploaded there.
2. Click **Start**.
3. Open the **Output** tab: one row per document. Download it as JSON, CSV or Excel, or read it through the API.

Leave everything empty and click Start to try it on one sample PDF (RFC 9309, 12 pages).

### Input

| Field | What it does | Default |
| --- | --- | --- |
| Document URLs (`documentUrls`) | Direct links to the files. Each link is downloaded once. | empty: the sample PDF if no store is set either |
| Key-value store (`keyValueStoreId`) | An Apify key-value store that holds files you uploaded (Console or API). Picking it in the store picker is what lets the run read it. | none |
| Record keys (`keys`) | The keys of the files in that store, for example `report.pdf`. Without a store they are read from the run's own default store. | none |
| Max documents (`maxDocuments`) | Documents past this number are listed as not processed (free). Up to 1,000. | 100 |
| Max file size (MB) (`maxFileSizeMb`) | Bigger files are not downloaded and are listed as too large (free). Up to 50. | 50 |
| Max pages per document (`maxPages`) | PDF pages or slides converted per document; the rest is cut and the row says `truncated`. Up to 2,000. | 500 |
| Page range (`pageRange`) | PDF and PowerPoint only: pages or slides such as `1-3,5,9-`. | all |
| Split by page (`includePages`) | Also return each page or slide on its own, with its number. | off |
| Plain text too (`includeText`) | Also return the document as plain text. | on |
| RAG chunk size (`chunkSize`) | Split the Markdown into chunks of about this many characters (500 to 100,000). 0 = off. | 0 |
| Chunk overlap (`chunkOverlap`) | Characters repeated between neighbouring chunks, at most half the chunk size. | 0 |
| Timeout per document (`timeoutSecs`) | Time allowed for the download and, separately, for the conversion. | 60 |
| Documents in parallel (`maxConcurrency`) | Documents converted at once; at most 2 downloads at once per website. | 3 |

The older `keyValueStoreRecords` list (`[{ "key": "report.pdf" }]`) still works for the run's own store.

Example input:

```json
{
  "documentUrls": [{ "url": "https://www.rfc-editor.org/rfc/rfc9309.pdf" }],
  "keyValueStoreId": "<your key-value store ID>",
  "keys": ["contract.docx", "slides.pptx"],
  "includePages": true,
  "chunkSize": 2000,
  "chunkOverlap": 200
}
```

### Output example

One row per document. A real row from a cloud run (RFC 9309, a 12-page PDF), with the long text fields shortened:

```json
{
  "source": "https://www.rfc-editor.org/rfc/rfc9309.pdf",
  "sourceType": "url",
  "finalUrl": "https://www.rfc-editor.org/rfc/rfc9309.pdf",
  "fileName": "rfc9309.pdf",
  "fileSizeBytes": 177688,
  "status": "ok",
  "docType": "pdf",
  "mime": "application/pdf",
  "title": "RFC 9309: Robots Exclusion Protocol",
  "markdown": "... # RFC 9309\n\n# Robots Exclusion Protocol\n\n## Abstract\n\nThis document specifies and extends the \"Robots Exclusion Protocol\" method ... (22,290 characters)",
  "text": "... (22,176 characters)",
  "pages": null,
  "pageCount": 12,
  "pagesProcessed": 12,
  "pagesWithoutText": 0,
  "truncated": false,
  "wordCount": 3202,
  "chunks": null,
  "metadata": {
    "title": "RFC 9309: Robots Exclusion Protocol",
    "subject": "This document specifies and extends the \"Robots Exclusion Protocol\" ...",
    "keywords": null,
    "language": null,
    "producer": "WeasyPrint 56.1",
    "createdAt": "2022-09-10T00:39:45.000Z",
    "modifiedAt": "2022-09-10T00:39:47.000Z"
  },
  "error": null,
  "processedAt": "2026-11-13T10:06:13.735Z"
}
```

`status` is one of `ok`, `no_text_layer`, `protected`, `blocked`, `unsupported`, `too_large` or `error`. Only `ok`
rows are charged; the others carry an `error` with a code and a plain message.

### Pricing

You pay per converted document (the `document` event): a document with status `ok`. Failed, protected,
scanned-without-text and too-large documents are free, and so are unsupported files and documents past "Max documents".
If your spending limit is reached, the run stops cleanly and tells you so.

| Apify plan | Price per 1,000 converted documents |
| --- | --- |
| Free | $4.00 |
| Bronze | $3.50 |
| Silver | $3.25 |
| Gold | $3.00 |

Apify's standard Actor start event is charged when a run starts, at the platform's default price: one event per GB of
run memory (4 events at the default 4 GB).

### Limits

- Up to 1,000 documents per run (default 100), files up to 50 MB, up to 2,000 pages per document (default 500).
- One row holds at most 5 million characters; use "Page range" or "Max pages" for very long documents.
- No login, no passwords, no cookies. Password-protected files and files whose owner turned off text extraction come
  back as `protected` (free); the Actor never removes protection or DRM. Files that only restrict printing or editing
  convert normally.
- It stops at CAPTCHAs and bot walls and does not try to get around them.
- Scanned PDFs come back as `no_text_layer` (free); there is no OCR.
- Memory: 4 GB by default, the fastest and cheapest per document. At 1 or 2 GB, very long PDFs (about 300+ pages) and
  very large web pages can pass the time limit (`TIMEOUT`, free); raise "Timeout per document" if you use less memory.

### FAQ

**Which files work?** PDF, DOCX, PPTX, HTML, Markdown and plain text. Old Word (.doc), Excel and images come back as
`unsupported` and are free.

**Can I convert files that are not on the web?** Yes. Upload them to a key-value store (Console or API), pick that store
in "Key-value store" and list the record keys in "Record keys".

**Can I use it for RAG?** Yes. Set "RAG chunk size" and "Chunk overlap", load `chunks` into your vector store and keep
`source`, `title` and `pageCount` as metadata. With "Split by page" you can index page by page and cite page numbers.

**Why is my document `protected` or `no_text_layer`?** `protected`: the file needs a password to open, or its
permissions forbid copying text. Remove the protection yourself if you have the right to, then run it again.
`no_text_layer`: the PDF is a scan (pictures of pages) with no text inside. Both are free.

**Can I call it from an AI agent?** Yes, through the Apify API, SDKs or MCP: pass `documentUrls`, then read the
dataset rows.

### Related tools by Tan Solutions

- [URL to Markdown](https://apify.com/tan-solutions/url-to-markdown): web pages to clean Markdown for LLMs, RAG pipelines and AI agents.
- [SEO Audit Tool](https://apify.com/tan-solutions/seo-audit): on-page SEO checker with PageSpeed for any list of pages.
- [Domain Intelligence](https://apify.com/tan-solutions/domain-intel): DNS, WHOIS/RDAP, SSL and tech stack for up to 1,000 domains.
- [US Company Filings & Financials](https://apify.com/tan-solutions/company-filings): 10-K, 10-Q, 8-K filings and XBRL facts by ticker.

### More from Tan Solutions

- [Document to Markdown tool page](https://www.tansolutions.org/tools/document-to-markdown/): details and examples for this Actor on our site.
- [Guide: PDF to Markdown, what survives and what does not](https://www.tansolutions.org/guides/pdf-to-markdown-what-survives/)
- [All Tan Solutions data tools](https://www.tansolutions.org/tools/)

### Your responsibilities

You are responsible for having the right to process each document you submit (copyright, confidentiality, and privacy
law for any personal data inside it) and for lawful use of the output. The Actor does not log in, does not remove
passwords or DRM and stops at bot walls. Text and layout extraction can be wrong; the Actor is provided without
warranty and liability is capped at the fees you paid in the last 12 months. Questions and issues are answered within
14 days through the Actor's Issues tab.

Not affiliated with Adobe or Microsoft. PDF, Word and PowerPoint are named only to describe the file formats; all
product names belong to their owners.

Made by Tan Solutions.

# Actor input Schema

## `documentUrls` (type: `array`):

Links to PDF, Word (.docx), PowerPoint (.pptx), HTML, Markdown or text files. Each link is downloaded once. Links that need a login are not supported. Leave this and the store fields empty to convert one sample PDF.

## `keyValueStoreId` (type: `string`):

An Apify key-value store that holds files you already uploaded (Console or API). Pick it here: picking it is what lets this run read it. Then list the record keys in Record keys.

## `keys` (type: `array`):

The keys of the files to convert in the key-value store above, one per line, for example report.pdf. Without a store, the keys are read from this run's own default store.

## `keyValueStoreRecords` (type: `array`):

Older way to name stored files, kept for existing inputs: a list of { "key": "report.pdf" } read from this run's default store. For any other store use Key-value store and Record keys above: a store named only here cannot be read.

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

Documents past this number are listed as not processed (free). Hard limit 1000 per run.

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

Bigger files are not downloaded (the download stops at the limit) and are listed as too_large (free). Hard limit 50 MB.

## `maxPages` (type: `integer`):

PDF pages or PowerPoint slides converted per document. The rest is cut and the item says truncated. Hard limit 2000.

## `pageRange` (type: `string`):

Only these PDF pages or PowerPoint slides, for example 1-3,5,9- (9- means 9 to the end). Word files have no fixed pages, so they are always converted whole.

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

Also return the Markdown of each PDF page or slide separately, with its page number.

## `includeText` (type: `boolean`):

Also return the document as plain text, without Markdown marks.

## `chunkSize` (type: `integer`):

Split the Markdown into chunks of about this many characters for embeddings. 0 = off. From 500 to 100000.

## `chunkOverlap` (type: `integer`):

Characters repeated between neighbouring chunks. Needs a chunk size, at most half of it.

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

Time allowed for the download and, separately, for the conversion of one document.

## `maxConcurrency` (type: `integer`):

How many documents are converted at once. At most 2 downloads run at once per website.

## Actor input object example

```json
{
  "documentUrls": [
    {
      "url": "https://www.rfc-editor.org/rfc/rfc9309.pdf"
    }
  ],
  "maxDocuments": 100,
  "maxFileSizeMb": 50,
  "maxPages": 500,
  "includePages": false,
  "includeText": true,
  "chunkSize": 0,
  "chunkOverlap": 0,
  "timeoutSecs": 60,
  "maxConcurrency": 3
}
```

# Actor output Schema

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

One item per document: status, title, pages and word count.

## `markdown` (type: `string`):

The Markdown of each document with its source.

# 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 = {
    "documentUrls": [
        {
            "url": "https://www.rfc-editor.org/rfc/rfc9309.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tan-solutions/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 = { "documentUrls": [{ "url": "https://www.rfc-editor.org/rfc/rfc9309.pdf" }] }

# Run the Actor and wait for it to finish
run = client.actor("tan-solutions/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 '{
  "documentUrls": [
    {
      "url": "https://www.rfc-editor.org/rfc/rfc9309.pdf"
    }
  ]
}' |
apify call tan-solutions/document-to-markdown --silent --output-dataset

```

## MCP server setup

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