# PDF to Markdown for LLM & RAG (Bulk, tables & headings) (`toowl/pdf-to-markdown`) Actor

Convert PDFs to clean Markdown in bulk from URLs: headings by font size, bold/italic, bullet and numbered lists, real Markdown tables (even across pages). Ready for ChatGPT, Claude, LangChain and vector databases. Pay per page.

- **URL**: https://apify.com/toowl/pdf-to-markdown.md
- **Developed by:** [Chalid Ade](https://apify.com/toowl) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 pdf page 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 — for LLMs, RAG and docs, in bulk

Convert PDFs into **clean, structured Markdown**: headings, bold/italic, bullet and numbered lists, and **real Markdown tables**. Feed the result straight into ChatGPT, Claude, LangChain, LlamaIndex or a vector database, or publish it as docs. Give a list of PDF URLs, get Markdown back.

### Why use it

- **Structure, not a text dump**: headings come from font sizes (H1–H3), short bold lines become small headings, lists keep their markers.
- **Tables as tables**: columns are found from the text layout, so reports, price lists and statements become `| a | b |` tables. A table that continues on the next page (repeated header) is merged into one.
- **Bold and italic** kept inline; Markdown characters escaped so the output renders correctly.
- **Optional page breaks** (`---`) for citing page numbers in RAG answers.
- **Fast and cheap**: no AI model, no GPU, no third-party API. Hundreds of pages per minute.
- **.md file per PDF** plus the Markdown right in the dataset for Zapier, Make, n8n or your code.

### Input

```json
{
  "files": [{ "url": "https://example.com/annual-report.pdf" }],
  "includeMarkdown": true,
  "pageBreaks": false,
  "maxPages": 200
}
```

### Output

```json
{
  "url": "https://example.com/annual-report.pdf",
  "name": "annual-report.pdf",
  "title": "Annual Report 2026",
  "pages": 24,
  "headings": 31,
  "tables": 6,
  "characters": 58210,
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/…/records/0001-annual-report.md",
  "markdown": "# Annual Report 2026\n\n## Summary\n\nRevenue grew **18%** …\n\n| Region | Q2 | Q3 |\n| --- | --- | --- |\n…"
}
```

### Good to know

- Works on **digital PDFs** (exported from Word, Google Docs, LaTeX, reporting tools, websites). A **scanned** PDF has no text layer: run it through the OCR Actor first.
- Password-protected PDFs get an `error` row and are not charged.
- Images inside the PDF are not exported.

### Use cases

- Prepare PDFs for retrieval-augmented generation (RAG) and embeddings
- Turn manuals, policies and handbooks into docs-site pages
- Extract tables from reports and price lists
- Summarise or translate long PDFs with an LLM without losing structure

### Pricing

Pay per event: a small fee **per page** converted (see the Pricing tab). Files that fail are free. Cap spending with "Max cost per run" and "Max pages per PDF".

### Free browser version

[toowl.my.id/tools/pdf-to-markdown](https://toowl.my.id/tools/pdf-to-markdown/) converts a PDF in your browser, free. Same engine.

# Actor input Schema

## `files` (type: `array`):

Direct links to digital PDFs (reports, papers, manuals, contracts, invoices). Scanned PDFs need the OCR Actor first.

## `includeMarkdown` (type: `boolean`):

Each row gets a markdown field, handy for LLM / RAG pipelines and integrations. A .md file is always saved too.

## `pageBreaks` (type: `boolean`):

Adds a --- line between pages (useful for citing page numbers in RAG).

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

Only the first pages are converted; each page is charged.

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

Larger files are skipped with an error (not charged).

## Actor input object example

```json
{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/report.pdf"
    }
  ],
  "includeMarkdown": true,
  "pageBreaks": false,
  "maxPages": 200,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

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

One row per input file, with a download link for the result where there is one.

## `files` (type: `string`):

Result files in the default key-value store, plus a SUMMARY record.

# 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 = {
    "files": [
        {
            "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/report.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("toowl/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 = { "files": [{ "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/report.pdf" }] }

# Run the Actor and wait for it to finish
run = client.actor("toowl/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 '{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/report.pdf"
    }
  ]
}' |
apify call toowl/pdf-to-markdown --silent --output-dataset

```

## MCP server setup

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