# PDF to Markdown & Text Converter (with OCR for Scanned PDFs) (`chris_elder/pdf-to-markdown`) Actor

Convert PDFs to clean, LLM-ready Markdown and text: headings, lists, tables, code blocks and multi-column layouts, with headers/footers removed. Scanned pages are OCR'd automatically. No API key, no LLM. $3 per 1,000 PDFs; failed files are free.

- **URL**: https://apify.com/chris_elder/pdf-to-markdown.md
- **Developed by:** [Chris Elder](https://apify.com/chris_elder) (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 pdf converteds

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 to Markdown & Text Converter (with OCR for scanned PDFs)

**PDF to Markdown** turns PDFs into clean, structured **Markdown** and **plain text** that LLMs, RAG pipelines and people can use. It rebuilds the document instead of dumping characters: **headings**, **paragraphs** (hyphenation fixed), **bulleted and numbered lists**, **tables**, **code blocks** and **two- or three-column layouts** in the right reading order. Running headers, footers and page numbers are removed. **Scanned pages are OCR'd automatically**, and only the pages that need it.

✅ **Pay per result: $3 per 1,000 PDFs** (up to 50 pages each) · 🆓 **Files that fail are never charged** · 🔑 No API key, no LLM, nothing sent to third-party AI services

[▶ Try it with one click](#how-to-use-it) · [📄 Real example output](#output-example-from-a-real-public-run) · [💲 Pricing](#how-much-does-it-cost-to-convert-pdf-to-markdown) · [🔌 API & integrations](#integrations-api-ai-agents-make-zapier) · [❓ FAQ](#faq) · [🛟 Support](#support-reliability-and-feature-requests)

### What does PDF to Markdown do?

- 🧠 **LLM / RAG-ready Markdown** – structure survives chunking far better than raw `pdftotext`; optional `<!-- page N -->` markers let you cite page numbers
- 📑 **Tables** – aligned rows and columns become Markdown tables (`| a | b |`)
- 📰 **Multi-column layouts** – academic papers, government guidance, newsletters
- 🖨️ **Scanned PDFs and image-only pages** – automatic OCR (Tesseract, 100+ languages); digital pages are never billed as OCR
- 🧹 **Noise removal** – repeated headers/footers, page numbers, rotated watermarks
- 🔐 **Password-protected and long PDFs** (default limits 100 MB and 300 pages; both adjustable)
- 📦 **Output** as dataset rows (JSON, CSV, Excel) and optional downloadable **`.md` files**

### Use cases

- **RAG and AI agents** – load reports, manuals, papers and contracts into Pinecone, Qdrant, Weaviate or pgvector with headings intact
- **Document digitisation** – make scanned letters, invoices and archives searchable
- **Research** – convert two-column academic papers to Markdown for notes and LLM summaries
- **Compliance and legal** – turn policies and terms into diffable text
- **Data extraction** – pull tables out of PDFs into Markdown

### How to use it

1. Click **Try for free** – the input is prefilled with a public IRS form (9 pages), so **Start** works straight away and costs about half a cent.
2. Paste **direct PDF links** (the URL must return the PDF file, not a viewer page). To convert your own files, put them anywhere that gives a direct download link (a public S3/R2/GCS bucket, your website, a Dropbox link ending in `?dl=1`) and paste the links.
3. Keep **OCR mode = Auto** (OCR only where needed), or choose **Never** for the cheapest text-only extraction.
4. Click **Start**. Download JSON, CSV or Excel, or open the `.md` files.

#### Input example

```json
{
  "pdfUrls": [{ "url": "https://www.irs.gov/pub/irs-pdf/iw8ben.pdf" }],
  "ocrMode": "auto",
  "saveMarkdownFiles": true
}
```

More options: `ocrLanguage` (e.g. `deu`, `fra`, `eng+spa`), `maxPagesPerPdf`, `detectTables`, `pageMarkers`, `includePlainText`, `includePerPage`, `password`, `maxFileSizeMb`, `maxConcurrency`.

#### Output example (from a real public run)

The example run above (IRS Instructions for Form W-8BEN, 9 pages, 9 Oct 2026) converted in 1.3 seconds. **See it yourself:** [full Markdown file](https://api.apify.com/v2/key-value-stores/iOJnjrSdK2GpgcI8z/records/iw8ben-1.md?signature=4QSmhEjVNbvfdcFB3DpK) · [dataset JSON](https://api.apify.com/v2/datasets/qIIhKI9qIq8cpO2xo/items?format=json\&clean=1)

```json
{
  "url": "https://www.irs.gov/pub/irs-pdf/iw8ben.pdf",
  "fileName": "iw8ben.pdf",
  "title": "Instructions for Form W-8BEN (Rev. October 2021)",
  "pageCount": 9,
  "pagesProcessed": 9,
  "ocrPages": 0,
  "tablesFound": 0,
  "wordCount": 8384,
  "charCount": 51355,
  "processingMs": 1279,
  "markdown": "# Instructions for Form W-8BEN\n\n## (Rev. October 2021)\n\n#### Certificate of Foreign Status of Beneficial Owner ...",
  "markdownFileUrl": "https://api.apify.com/v2/key-value-stores/iOJnjrSdK2GpgcI8z/records/iw8ben-1.md?signature=..."
}
```

An excerpt of the `markdown` field, exactly as produced:

```markdown
##### Purpose of Form

Establishing status for chapter 3 purposes. Foreign persons are subject to U.S. tax at a 30% rate on income they receive from U.S. sources that consists of:

- Interest (including certain original issue discount (OID));
- Dividends;
- Rents;
- Royalties;
```

| Field | Description |
|---|---|
| `markdown` | The document as clean Markdown |
| `text` | Plain text (Markdown removed, table cells tab-separated) |
| `title`, `author`, `metadata` | From the PDF metadata (title falls back to the first heading) |
| `pageCount`, `pagesProcessed`, `ocrPages`, `ocrMeanConfidence` | Processing stats |
| `tablesFound`, `wordCount`, `charCount`, `processingMs` | Content stats |
| `pages[]` | Optional per-page Markdown |
| `markdownFileUrl` | Link to the `.md` file (with *Save Markdown files*) |

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

Pay-per-event pricing: you pay only for PDFs converted. No platform usage charges on top.

| Event | Price | Notes |
|---|---|---|
| **PDF converted** (includes up to 50 pages) | **$0.003** ($3 per 1,000 PDFs) | Silver $0.0025, Gold and above $0.002 |
| Extra page beyond 50 | $0.0002 per page | Long documents only |
| OCR page | $0.006 per page | Only scanned/image pages, only in *Auto* or *Always* mode. Silver $0.005, Gold $0.004 |
| Run start | $0.001 per GB of memory | Default 2 GB = $0.002 per run |

**Worked examples (Free/Starter prices, default memory):**

| Job | Calculation | Total |
|---|---|---|
| One-click example (one 9-page digital PDF) | $0.003 + $0.002 start | **$0.005** |
| 1,000 ten-page digital PDFs in one run | 1,000 × $0.003 + $0.002 | **$3.00** |
| One 200-page digital report | $0.003 + 150 × $0.0002 + $0.002 | **$0.035** |
| One 20-page scanned contract | $0.003 + 20 × $0.006 + $0.002 | **$0.125** |

**Never charged:** files that fail (404, not a PDF, wrong password, over your size limit). Cap spending with Apify's **Max cost per run** – the Actor stops cleanly at the limit. Apify's Free plan includes $5 of monthly credit.

### Integrations (API, AI agents, Make, Zapier)

**API** – convert and get results in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/chris_elder~pdf-to-markdown/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"pdfUrls":[{"url":"https://www.irs.gov/pub/irs-pdf/iw8ben.pdf"}]}'
```

```python
from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("chris_elder/pdf-to-markdown").call(run_input={"pdfUrls": [{"url": "https://www.irs.gov/pub/irs-pdf/iw8ben.pdf"}]})
for doc in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(doc["title"], doc["wordCount"])  # doc["markdown"] -> your chunker / vector DB
```

**AI agents (MCP)** – add `https://mcp.apify.com/?tools=chris_elder/pdf-to-markdown` to Claude, Cursor, VS Code or any MCP client, and your agent can read any PDF link as Markdown.

**Make, Zapier, n8n** – use the Apify app's **Run Actor** action with `chris_elder/pdf-to-markdown`, then send the Markdown to Notion, Google Docs, a vector database or email. **Webhooks** in Apify Console fire when a run finishes.

### Limits and good to know

- Complex tables (merged cells, nested headers) are approximated. Scanned tables are OCR'd as text, best effort.
- Math formulas come out as Unicode text, not LaTeX.
- Images and charts are not described (no AI vision, which keeps it cheap and private).
- The link must return the PDF itself. Viewer pages (Google Drive preview, DocSend) won't work.
- OCR quality depends on scan quality; `ocrMeanConfidence` tells you how sure the OCR was.

### Is it legal?

The Actor downloads only the files you give it, one request per file, and converts them. It doesn't crawl websites, log in or bypass protection. Make sure you have the right to process the documents (your own files, public-domain or openly licensed documents, or documents you're licensed to use). Personal data inside documents is processed only to produce your output.

### FAQ

**Does it use ChatGPT or another LLM?** No. Conversion is deterministic (pdf.js layout analysis plus Tesseract OCR), so results are reproducible and documents never leave the Apify platform.

**Which OCR languages are supported?** English is built in; any Tesseract language code works, e.g. `deu`, `fra`, `spa` or `eng+deu`.

**How do I convert files on my computer?** Upload them somewhere that gives a direct download link (a public S3/R2/GCS bucket, your website, or a Dropbox link ending in `?dl=1`), then paste the links.

**My PDF failed.** Open `RUN_SUMMARY` in the key-value store for the reason (404, not a PDF, password, too large). You weren't charged for it.

### Support, reliability and feature requests

- **Failed files are free.** You pay only for PDFs converted.
- **Tested on real documents before every release** (IRS forms, 15-page arXiv papers with tables, 29-page reports, scanned pages).
- **Issues answered within 2 business days.** Open an issue on the **Issues** tab with a sample PDF link.
- **Feature requests welcome** – open an issue titled "Feature request: …".
- Built by Chris Elder with AI-assisted development; every release is reviewed and tested before it ships.

### Need the data done for you?

If you'd rather not set up runs yourself, the UK company behind these tools (GPT Shop Ltd) offers a fixed-price done-for-you scrape. Tell us the website and the fields you need, and you get a clean CSV or Google Sheet within 48 hours of the confirmed brief, up to 5,000 rows, for £149 or $179. If we can't get the data, you're refunded in full. [See the done-for-you scraper service](https://sme-free-tools.pages.dev/done-for-you-scraper/?utm_source=apify\&utm_medium=readme\&utm_campaign=pdf-to-markdown)

### More tools by Chris Elder

- [Sitemap URL Extractor](https://apify.com/chris_elder/sitemap-url-extractor) – every URL from a website's sitemaps (find all PDFs on a site with an include pattern like `\.pdf$`)
- [Bulk Lighthouse & PageSpeed Audit](https://apify.com/chris_elder/lighthouse-batch-auditor) – Core Web Vitals and SEO scores for many URLs
- [Bulk WHOIS Domain Lookup](https://apify.com/chris_elder/bulk-whois-domain-lookup) – registrar, expiry, availability and DNS for many domains via official RDAP
- [Image to Text OCR](https://apify.com/chris_elder/image-to-text-ocr) – bulk text extraction from images in 100+ languages
- All tools: [apify.com/chris_elder](https://apify.com/chris_elder)

# Actor input Schema

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

Direct links to PDF files (http/https). You can also upload a file to an Apify key-value store and paste its public URL.

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

auto = OCR only pages that have no text layer but contain an image (scans, photos). always = OCR every page. never = text layer only (cheapest).

## `ocrLanguage` (type: `string`):

Tesseract language code(s), e.g. eng, deu, fra, spa, ita, por, nld, pol, eng+deu. English is built in; other languages are downloaded once per run.

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

Only the first N pages of each PDF are converted.

## `detectTables` (type: `boolean`):

Turn aligned rows/columns into Markdown tables.

## `pageMarkers` (type: `boolean`):

Insert  comments so you can cite page numbers (useful for RAG).

## `includePlainText` (type: `boolean`):

Also output a plain-text version (Markdown syntax removed).

## `includePerPage` (type: `boolean`):

Add a pages\[] array with Markdown for each page.

## `saveMarkdownFiles` (type: `boolean`):

Also store each document as a downloadable .md file (always done for very large documents).

## `password` (type: `string`):

Password for encrypted PDFs (applied to all files).

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

Skip files larger than this.

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

How many PDFs are processed at once. Kept low to be gentle on source servers.

## Actor input object example

```json
{
  "pdfUrls": [
    {
      "url": "https://www.irs.gov/pub/irs-pdf/iw8ben.pdf"
    }
  ],
  "ocrMode": "auto",
  "ocrLanguage": "eng",
  "maxPagesPerPdf": 300,
  "detectTables": true,
  "pageMarkers": false,
  "includePlainText": true,
  "includePerPage": false,
  "saveMarkdownFiles": false,
  "maxFileSizeMb": 100,
  "maxConcurrency": 2
}
```

# Actor output Schema

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

No description

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

No description

## `summary` (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 = {
    "pdfUrls": [
        {
            "url": "https://www.irs.gov/pub/irs-pdf/iw8ben.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("chris_elder/pdf-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 = { "pdfUrls": [{ "url": "https://www.irs.gov/pub/irs-pdf/iw8ben.pdf" }] }

# Run the Actor and wait for it to finish
run = client.actor("chris_elder/pdf-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 '{
  "pdfUrls": [
    {
      "url": "https://www.irs.gov/pub/irs-pdf/iw8ben.pdf"
    }
  ]
}' |
apify call chris_elder/pdf-to-markdown --silent --output-dataset

```

## MCP server setup

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