# PDF to Markdown: Tables, OCR & RAG Chunks (`plainfeed/pdf-to-markdown`) Actor

Convert PDFs from URLs into clean Markdown or text with headings, lists and tables. OCR for scanned pages in 12 languages, and output per document, per page, or as chunks ready for embeddings and RAG.

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

## Pricing

from $2.00 / 1,000 pdfs

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

### What does PDF to Markdown do?

**PDF to Markdown converts PDF files from URLs into clean, structured Markdown or plain text.** It keeps what matters for reading and for AI: **headings, paragraphs in the right reading order (including two-column layouts), bulleted and numbered lists, and tables** as Markdown tables. Scanned pages are read with **OCR in 12 languages**. You get one result per PDF, per page, or as **ready-to-embed chunks for RAG**.

Run it from Apify Console, call it through the Apify API, schedule it, or plug it into LangChain, LlamaIndex, Make, Zapier and other integrations.

### Why use PDF to Markdown?

- **RAG and AI assistants:** feed LLMs clean text instead of broken PDF extracts. Chunk mode splits on paragraph boundaries with overlap.
- **Research and analysis:** turn reports, papers and filings into searchable text with headings preserved.
- **Data pipelines:** pull tables out as Markdown, or use plain text with tab-separated table rows.
- **Scanned archives:** OCR turns image-only pages into text automatically.

### How to use PDF to Markdown

1. Click **Try for free**.
2. Add your PDF links under **PDF URLs**, or upload a text file with one URL per line.
3. Pick **Markdown** or **Plain text**, and choose one result per **document**, **page** or **chunk**.
4. Click **Start**. Download the results as JSON, CSV, Excel or HTML, or read them through the API.

### Input

```json
{
  "pdfUrls": [{ "url": "https://arxiv.org/pdf/1706.03762" }],
  "outputFormat": "markdown",
  "splitBy": "chunk",
  "chunkSize": 2000,
  "chunkOverlap": 200,
  "extractTables": true,
  "ocr": "auto",
  "ocrLanguages": ["eng"],
  "pages": "1-10",
  "saveMarkdownFiles": false
}
```

See the **Input** tab for all options, including a page selection (e.g. `1-5, 8`), a page limit per PDF, and a maximum file size.

### Output

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel. Example of one chunk:

```json
{
  "url": "https://arxiv.org/pdf/1706.03762",
  "fileName": "1706.03762.pdf",
  "status": "ok",
  "pageCount": 15,
  "pagesProcessed": 15,
  "ocrPages": 0,
  "tablesFound": 6,
  "metadata": { "title": null, "creator": "LaTeX with hyperref", "producer": "pdfTeX-1.40.25", "createdAt": "2024-04-10T21:11:43" },
  "chunkIndex": 0,
  "chunkCount": 28,
  "content": "Provided proper attribution is provided, Google hereby grants permission to reproduce the tables and figures in this paper solely for use in journalistic or scholarly works.\n\n# Attention Is All You Need\n\n…",
  "charCount": 1756,
  "processedAt": "2026-09-17T10:12:03+00:00"
}
```

With **Also save each document as a file** on, every PDF's full Markdown is also stored as a `.md` file, and `fileUrl` links to it.

### Data fields

| Field | Description |
| --- | --- |
| `url`, `fileName` | Source PDF |
| `status`, `error` | `ok`, or `error` with the reason (e.g. not a PDF, too large) |
| `pageCount`, `pagesProcessed` | Pages in the PDF and pages converted |
| `ocrPages`, `tablesFound` | How many pages needed OCR and how many tables were extracted |
| `metadata` | Title, author, subject, creator, producer, created and modified dates |
| `content` | The Markdown or text for the document, page or chunk |
| `pageNumber` | In page mode |
| `chunkIndex`, `chunkCount` | In chunk mode |
| `wordCount`, `charCount` | Size of the content |
| `fileUrl` | Link to the saved `.md`/`.txt` file, when enabled |

### How much does it cost?

Pay-per-event pricing, so you pay only for what you convert:

- **$2.00 per 1,000 PDFs**
- **$0.05 per 1,000 pages**
- **$2.00 per 1,000 OCR pages** (only pages that needed OCR)

For example, 1,000 ten-page digital PDFs cost about **$2.50**. A 100-page scanned document costs about $0.21. Apify's free plan includes monthly usage credits to try it. Set a maximum cost per run in the run options and the Actor stops cleanly when it's reached.

### Tips

- Use **Pages** to convert only the parts you need, such as the first 10 pages of long reports.
- Choose only the **OCR languages** actually in your scans; fewer languages give better accuracy.
- Set **OCR** to **Off** for digital PDFs when you're sure there are no scanned pages, to guarantee no OCR charges.
- For RAG, 1,000–2,000 character chunks with 10% overlap are a good starting point.

### FAQ, limitations and support

**What kinds of tables are extracted?** Tables drawn with lines or cell borders are extracted as tables. Tables laid out only with spacing (common in academic papers) come through as text instead.

**How good is the reading order?** Single- and two-column layouts, like reports and academic papers, come out in reading order. Very complex magazine-style layouts, text inside figures, and equations may come out in a less natural order.

**Can it read password-protected PDFs?** No. Encrypted PDFs that need a password return an error.

**Where do the PDFs come from?** Only from the URLs you provide. You're responsible for having the right to process those documents.

**Found a PDF that converts badly?** Open an issue in the **Issues** tab with the link and it will be looked at promptly.

# Actor input Schema

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

Direct links to PDF files. You can also upload a text file with one URL per line.

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

Markdown keeps headings, lists and tables. Plain text drops the formatting.

## `splitBy` (type: `string`):

Get one item per PDF, one per page, or text chunks ready for embeddings and RAG.

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

Used when splitting into chunks. Chunks break at paragraph boundaries where possible.

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

Characters repeated from the end of one chunk at the start of the next.

## `extractTables` (type: `boolean`):

Detect tables and output them as Markdown tables (or tab-separated rows in plain text).

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

Auto reads pages that have no text layer (scans, images) with OCR. Always runs OCR on every page. Off skips OCR.

## `ocrLanguages` (type: `array`):

Languages in the scanned documents. Choosing only the languages you need gives better accuracy.

## `pages` (type: `string`):

Optional page selection like 1-5, 8, 10-. Leave empty for all pages.

## `maxPagesPerDocument` (type: `integer`):

Stop after this many pages in each PDF.

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

Skip PDFs larger than this.

## `includeMetadata` (type: `boolean`):

Title, author, creator and dates from the PDF's properties.

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

Save the full Markdown (or text) of each PDF as a file in the run's key-value store and add its link to the output.

## Actor input object example

```json
{
  "pdfUrls": [
    {
      "url": "https://arxiv.org/pdf/1706.03762"
    }
  ],
  "outputFormat": "markdown",
  "splitBy": "document",
  "chunkSize": 2000,
  "chunkOverlap": 200,
  "extractTables": true,
  "ocr": "auto",
  "ocrLanguages": [
    "eng"
  ],
  "maxPagesPerDocument": 300,
  "maxFileSizeMb": 50,
  "includeMetadata": true,
  "saveMarkdownFiles": false
}
```

# Actor output Schema

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

No description

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

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

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

```

## MCP server setup

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