# PDF to Markdown & Text Converter for LLM/RAG (DOCX, HTML) (`steadyline/pdf-document-to-markdown`) Actor

Convert PDFs, Word DOCX, HTML and text files from URLs into clean Markdown or plain text for LLMs, RAG and search. Headings, lists, per-page output, metadata, chunking with overlap and scanned-PDF detection. $2 per 1,000 documents. By Steadyline Data.

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

## Pricing

from $2.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 Text/Markdown (DOCX, HTML)

Turn public **PDF, Word (.docx), HTML and text files** into clean **Markdown** or **plain text**, ready for LLMs, RAG pipelines, search indexes and data entry.

- **PDF**: text in reading order, with headings detected from font size, bullet and numbered lists, de-hyphenation, and `|` between columns that sit far apart. Rotated margin text and watermarks are skipped. You also get metadata (title, author, dates, producer), page counts, optional **per-page** output, and a **scanned-PDF flag** for files with no text layer.
- **DOCX**: headings, lists, bold/italic, links and tables.
- **HTML**: main-content extraction; navigation, header and footer are dropped.
- **TXT / MD / CSV / JSON**: passed through as UTF-8.
- **Chunking** for embeddings: paragraph-aware chunks with overlap.
- Big outputs are stored in the key-value store and linked from the dataset row, so you never hit item size limits.

No OCR: image-only PDFs are flagged as `no-text` and are **not charged**.

### Use cases

- **RAG pipelines:** turn PDF and DOCX links into Markdown chunks with overlap, ready for embedding.
- **AI agents:** give an agent a document URL and get readable text back.
- **Search indexing:** extract text and metadata (title, author, pages) from document libraries.
- **Research and compliance:** bulk-convert filings, reports and policies.
- **Data pipelines:** a document-to-text step for Zapier/Make/n8n.

### Input

```json
{
  "startUrls": [{ "url": "https://arxiv.org/pdf/1706.03762" }, { "url": "https://example.com/report.docx" }],
  "outputFormat": "markdown",
  "includePages": false,
  "chunkSize": 2000
}
```

### Output sample (shortened)

```json
{
  "url": "https://arxiv.org/pdf/1706.03762", "status": "ok", "documentType": "pdf",
  "title": null, "totalPages": 15, "pagesProcessed": 15, "words": 6268, "characters": 40210,
  "likelyScanned": false, "fileSizeBytes": 2215244, "sha256": "…",
  "metadata": { "author": null, "creator": "LaTeX with hyperref", "producer": "pdfTeX-1.40.25", "creationDate": "2024-04-10T21:11:43.000Z" },
  "markdown": "# Attention Is All You Need\n\n…\n\n### Abstract\n\nThe dominant sequence transduction models are …",
  "chunks": ["# Attention Is All You Need …", "…"]
}
```

The dataset has two views: **Overview** and **Content**.

### Pricing (pay per event)

| Event | Price | When |
|---|---|---|
| `document-converted` | **$0.002** per document | A document was downloaded and produced non-empty Markdown/text. |

These are **never charged**: download errors (404, timeouts), unsupported or legacy formats (.doc), oversized files, password errors, and scanned PDFs with no text. Platform usage is extra. Memory defaults to 1 GB; raise it for very large PDFs.

**Cost example:** converting 1,000 PDFs costs **$2.00** in events, plus platform usage (typically a few cents for average-size PDFs).

### Limits

- Only publicly reachable URLs. No logins or cookies.
- Complex layouts (multi-column scientific papers, forms, tables) come out as readable text, not pixel-perfect structure.
- Legacy `.doc`, `.ppt`, `.xls` and images are not supported.

### Use it from AI agents (MCP), Zapier, Make, n8n or the API

**AI agents (Claude, Cursor, VS Code, ChatGPT and other MCP clients).** Add Apify's hosted MCP server with just this Actor as a tool:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=steadyline/pdf-document-to-markdown"
    }
  }
}
```

Sign in with Apify (OAuth) on first connect, or add an `Authorization: Bearer <APIFY_TOKEN>` header. Then ask your agent, for example:

> Use steadyline/pdf-document-to-markdown to convert these 5 PDF reports to Markdown, split into 1,500-character chunks, and summarize each.

The agent sees this Actor's input schema and output fields, so it can call it without extra prompting. Agents that use the general Apify MCP server can also find it with `search-actors`.

This Actor uses pay-per-event pricing with limited permissions, so it can also be run through Apify's agentic payments (no Apify account needed for the agent). See the [Apify docs](https://docs.apify.com/platform/integrations/mcp#agentic-payments).

**Zapier, Make and n8n.** Use the official Apify app: Zapier "Run Actor" action, Make "Run an Actor" module, or the n8n Apify node. Choose `steadyline/pdf-document-to-markdown`, paste the input below, then use "Get dataset items" (or the run's dataset) to send results to Google Sheets, Slack, a CRM or a database.

**API (any language).** Run it and get the results in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/steadyline~pdf-document-to-markdown/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": [{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"}]}'
```

Or with the Python client (`pip install apify-client`):

```python
from apify_client import ApifyClient
client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("steadyline/pdf-document-to-markdown").call(run_input={"startUrls": [{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"}]})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

### Works well with other Steadyline Data tools

- **Website → RAG knowledge base:** find document URLs with [Site Discovery](https://apify.com/steadyline/site-discovery), convert them here, and fetch HTML pages as Markdown with [HTTP Request Runner](https://apify.com/steadyline/http-request-runner).
- Related: [Site Discovery (sitemaps, robots.txt, llms.txt)](https://apify.com/steadyline/site-discovery), [Bulk HTTP Request Runner](https://apify.com/steadyline/http-request-runner), [App Store Reviews & App Details](https://apify.com/steadyline/app-store-reviews).

### FAQ

**Does it do OCR?**
No. Scanned (image-only) PDFs are detected and flagged with `likelyScanned: true` so you can route them to an OCR tool.

**Which formats are supported?**
PDF, DOCX, HTML and plain text from public URLs. Password-protected PDFs work if you supply `pdfPassword`.

**What does it cost?**
$0.002 per document converted. Failed downloads are not charged.

**Can I run it on a schedule?** Yes. Create an Apify Schedule (or a saved Task with a schedule) and connect a webhook or integration to receive results.

**Need a feature or found a bug?** Open an issue on the Issues tab of this page or email steadylinedata@proton.me. Built and maintained by **Steadyline Data**.

### Acceptable use

Convert only documents you have the right to access and process. Respect copyright and the source site's terms. You're responsible for how the extracted content is stored and used.

***

Built and maintained by **Steadyline Data**. PDF parsing uses Mozilla pdf.js (Apache-2.0); DOCX uses mammoth (BSD-2-Clause).

# Actor input Schema

## `startUrls` (type: `array`):

Public URLs of PDF, DOCX, HTML, TXT/MD/CSV/JSON files.

## `outputFormat` (type: `string`):

Markdown keeps headings, lists and links; text is plain.

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

Also return an array with the content of each PDF page.

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

If > 0, also split the content into chunks of about this many characters (paragraph-aware) for RAG/embeddings. 0 = off.

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

Overlap between consecutive chunks.

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

Pages converted per PDF. Longer PDFs are cut and flagged.

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

Larger files are skipped (not charged).

## `pdfPassword` (type: `string`):

Optional, for password-protected PDFs.

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

Documents processed in parallel. Raise memory for big PDFs.

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

Per document download.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ],
  "outputFormat": "markdown",
  "includePages": false,
  "chunkSize": 0,
  "chunkOverlap": 200,
  "maxPages": 200,
  "maxFileSizeMb": 50,
  "maxConcurrency": 4,
  "timeoutSecs": 120
}
```

# Actor output Schema

## `overview` (type: `string`):

One row per document.

## `content` (type: `string`):

Converted content.

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

```

## MCP server setup

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