# PDF to Markdown Converter — LLM-Ready Text & RAG Chunks (`actor-forge/pdf-to-markdown`) Actor

Convert PDF URLs to clean, LLM-ready Markdown: headings, paragraphs and lists rebuilt from the layout, running headers and page numbers removed, plus plain text, per-page content, RAG chunks and metadata. Finds PDFs linked from web pages. $3 per 1,000 PDFs + $0.20 per 1,000 pages.

- **URL**: https://apify.com/actor-forge/pdf-to-markdown.md
- **Developed by:** [ActorForge](https://apify.com/actor-forge) (community)
- **Categories:** AI, Developer tools, Integrations
- **Security:** 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 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.

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 Converter — LLM-Ready Text & RAG Chunks

Convert PDF URLs to clean, LLM-ready Markdown: headings, paragraphs and lists rebuilt from the layout, running headers and page numbers removed, plus plain text, per-page content, RAG chunks and metadata. Finds PDFs linked from web pages. $3 per 1,000 PDFs + $0.20 per 1,000 pages.

**Turn PDFs into clean, LLM-ready Markdown.** Paste PDF links (or a web page that links to PDFs) and get one row per PDF. The document structure is rebuilt from its layout: **headings** (from font sizes, section numbering and the PDF's bookmarks), **paragraphs** re-joined across line and page breaks with hyphenation undone, **bullet and numbered lists**, and tables of contents. **Running headers, footers and page numbers are removed**, and so is rotated margin text. Each row also has title, author, subject, keywords, language, creation and modification dates, page count and word count, plus optional **plain text, per-page content, or ready-to-embed RAG chunks** that carry their heading path. Use it to feed **RAG pipelines and vector databases**, build chatbot knowledge bases from manuals, research papers, reports, regulations and policies, give **AI agents** a PDF-reading tool, or bulk-extract text from document archives. **Simple pricing: $3 per 1,000 PDFs + $0.20 per 1,000 pages**, so a 10-page PDF costs $0.005, with no compute bill on top. Scanned pages without text, failed downloads, invalid or locked files and duplicates are never charged.

### What data does it return?

Every run outputs clean, schema-validated rows like these:

| url | title | pageCount | wordCount | markdown |
| --- | --- | --- | --- | --- |
| https://arxiv.org/pdf/1706.03762 | Attention Is All You Need | 15 | 5811 | # Attention Is All You Need\n\n…\n\n## 1 Introduction\n\nRecurrent neural networks, long short-term memory… |
| https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.29.pdf | The NIST Cybersecurity Framework (CSF) 2.0 | 32 | 9027 | # The NIST Cybersecurity Framework (CSF) 2.0\n\n…\n\n- 1. Cybersecurity Framework (CSF) Overview … 1 |
| https://www.irs.gov/pub/irs-pdf/fw9.pdf | Form W-9 (Rev. March 2024) | 6 | 6239 | # Request for Taxpayer Identification Number and Certification\n\n… |

### How much does it cost?

Transparent pay-per-event pricing — you only pay for what you get, and the
actor **always respects your run budget**: set a maximum total charge and it
stops cleanly at the cap instead of overrunning.

| Event | Price | Charged | Worked example |
| --- | --- | --- | --- |
| `pdf-converted` | $0.003 | per PDF converted and delivered (all output formats and chunks included) | 1,000 PDFs = $3.00 + their pages |
| `page-converted` | $0.0002 | per page with text converted (scanned pages without text are free) | A 10-page PDF = $0.003 + 10 × $0.0002 = $0.005; a 100-page report = $0.023 |
| `apify-actor-start` | $0.00005 | per run per GB of memory (platform start fee) | One run at 4 GB = $0.0002 |

### Input options

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `urls` | array | yes | — | Links to PDF files. You can also add a web page (e.g. a reports or publications page): every PDF it links to is converted. |
| `outputMode` | string | no | `"document"` | One row per PDF (whole document), or one row per page (handy for page-level citations). |
| `outputFormats` | array | no | `["markdown"]` | Which content fields to return. Same price whatever you pick. |
| `chunkSize` | integer | no | `0` | Also split each PDF into chunks (one-row-per-PDF mode only) of at most this many characters for embedding, split at headings and paragraphs, each with its heading path. 0 = no chunks. Around 1,500–4,000 suits most embedding models. |
| `includePages` | boolean | no | `false` | In one-row-per-PDF mode, also add a pages array with each page's Markdown/text and word count. |
| `maxPagesPerPdf` | integer | no | `1000` | Convert at most this many pages of each PDF (from the start). Longer PDFs are marked truncated. |
| `maxPdfs` | integer | no | `1000` | Stop after converting this many PDFs (including ones found on web pages). |
| `findPdfLinks` | boolean | no | `true` | When a URL is a web page rather than a PDF, convert the PDFs it links to (one level, robots.txt respected). |
| `password` | string | no | — | For password-protected PDFs you are entitled to open. Used for every PDF in the run. |

### Limits & honest notes

- Text is read from the PDF's text layer. Scanned PDFs (images of pages) have no text layer: they are reported and not charged. For those, use our OCR to Text actor (apify.com/actor-forge/ocr-to-text).
- Tables come out as lines of text in reading order, not as Markdown tables. Images and figures are skipped. Mathematical formulas come out as their plain characters.
- Headings are inferred from the layout. Font sizes, section numbers such as "3.1", and the PDF's bookmarks all count, but bold text at body size without numbering stays a paragraph.
- PDFs up to 100 MB and up to 5,000 pages each (1,000 by default). Password-protected PDFs need the password input.
- Web pages in the input are scanned for links to .pdf files (one level deep, robots.txt respected). If a site's robots.txt can't be fetched (HTTP 5xx or a network error, after one retry), the PDFs linked on that site are skipped (RFC 9309) and the page gets a free row saying why. Pages behind a login are not supported.
- Respects your run budget: set a maximum total charge and conversion stops cleanly at the cap, with no PDF charged twice.

### Related ActorForge actors

- [PDF OCR](https://apify.com/actor-forge/pdf-ocr) — for scanned PDFs with no text layer
- [PDF to Text](https://apify.com/actor-forge/pdf-to-text)
- [Word, Excel & PowerPoint to Markdown](https://apify.com/actor-forge/office-to-markdown) — Word, Excel and PowerPoint
- [Website to Markdown](https://apify.com/actor-forge/website-to-markdown)

### Changelog

- **2026-10-18** — Initial release: layout-aware Markdown (headings, paragraphs, lists, table of contents), header/footer removal, metadata, plain text, per-page and per-PDF rows, RAG chunks, PDF-link discovery on web pages.

***

*Built and maintained by **ActorForge**. Reliability first: every actor in the
portfolio is monitored by an automated nightly self-test, and breakages are
typically fixed the same day.*

# Actor input Schema

## `urls` (type: `array`):

Links to PDF files. You can also add a web page (e.g. a reports or publications page): every PDF it links to is converted.

## `outputMode` (type: `string`):

One row per PDF (whole document), or one row per page (handy for page-level citations).

## `outputFormats` (type: `array`):

Which content fields to return. Same price whatever you pick.

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

Also split each PDF into chunks (one-row-per-PDF mode only) of at most this many characters for embedding, split at headings and paragraphs, each with its heading path. 0 = no chunks. Around 1,500–4,000 suits most embedding models.

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

In one-row-per-PDF mode, also add a pages array with each page's Markdown/text and word count.

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

Convert at most this many pages of each PDF (from the start). Longer PDFs are marked truncated.

## `maxPdfs` (type: `integer`):

Stop after converting this many PDFs (including ones found on web pages).

## `findPdfLinks` (type: `boolean`):

When a URL is a web page rather than a PDF, convert the PDFs it links to (one level, robots.txt respected).

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

For password-protected PDFs you are entitled to open. Used for every PDF in the run.

## Actor input object example

```json
{
  "urls": [
    "https://arxiv.org/pdf/1706.03762"
  ],
  "outputMode": "document",
  "outputFormats": [
    "markdown"
  ],
  "chunkSize": 0,
  "includePages": false,
  "maxPagesPerPdf": 1000,
  "maxPdfs": 1000,
  "findPdfLinks": true
}
```

# Actor output Schema

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

One row per PDF (or page) with clean Markdown, optional plain text, per-page content and RAG chunks, plus metadata.

## `summary` (type: `string`):

PDFs and pages converted, URLs that failed or were skipped, and skip reasons (none of them charged).

# 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 = {
    "urls": [
        "https://arxiv.org/pdf/1706.03762"
    ]
};

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

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

```

## MCP server setup

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