# PDF to Markdown API — Text, Headings & Metadata from Any PDF (`highbrow_fame/pdf-to-markdown-api`) Actor

Converts PDFs at public links to Markdown and plain text with page markers, headings, links and metadata; scanned pages are flagged, never charged. Unofficial PDF to Markdown API.

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

## Pricing

$3.00 / 1,000 documents

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 API — Text, Headings & Metadata from Any PDF

Give it links to PDF files and get each one back as clean Markdown — headings, paragraphs, lists, tables and links, with a marker at every page break — plus the plain text, a list of headings and tables, the web links and the document's metadata. Built for RAG pipelines, LLM agents and document workflows that need PDFs as text they can actually use.

**Try it in 1 minute:**

1. Press **Start** — the prefilled input converts the "Attention Is All You Need" paper from arXiv (15 pages, about half a second).
2. Open the **Output** tab: one record with `markdown`, `text`, `headings`, `tables`, `links` and `metadata`.
3. Price: **$3.00 per 1,000 documents.** Files that give no text (404, not a PDF, scanned without a text layer, too large) are free.

**Use it to:**

- **Feed PDFs to an LLM or a vector database** as Markdown that keeps the structure: headings, lists, tables.
- **Index reports, papers, manuals and filings** from public links in bulk, page by page.
- Let an **AI agent read a PDF** it found on the web without downloading it first.
- **Extract tables** (pricing sheets, results, schedules) as rows you can load into a spreadsheet.
- **Pull metadata** — title, creation date, producer — for a document catalogue.

### How it works

Each PDF is downloaded (up to 100 MB; the link must return a real PDF, not an HTML page) and read with the open-source pdf.js engine. Every text run comes with its position and font size, so lines are rebuilt top to bottom, a wide gap inside a line becomes a table cell boundary and a tall gap a paragraph break. From that, plain rules make Markdown: a line in a clearly larger font than the body (or an ALL CAPS / numbered "2.3 Method" line) is a heading, bullets become list items, hyphenated line breaks are joined, wrapped lines merge back into paragraphs, three or more aligned lines become a GFM table. Pages are joined with `<!-- page N -->` markers and a rule, so you can split the document again by page. Text set at an angle (side watermarks) is left out.

The Author field of the PDF and any e-mail addresses or phone numbers in the text are not delivered. Only public links: no login, no cookies.

### Input

| Field | What it does | Default |
|---|---|---|
| `urls` | Links to PDF files, one per line | the arXiv paper |
| `pages` | Pages to read: `1-5, 8` or `10-`; empty = all | all |
| `outputFormat` | `both`, `markdown` or `text` | `both` |
| `maxPages` | Read at most this many pages (0 = all, up to 2,000) | `0` |
| `includePages` | Also deliver one entry per page | `false` |
| `maxTextLength` | Cut `markdown` and `text` after this many characters | `0` |
| `maxConcurrency` | PDFs read at the same time | `3` |
| `proxyConfiguration` | Used only when a site turns a direct download down | Apify Proxy |

### Output

One record per PDF:

| Field | What it is |
|---|---|
| `markdown` | The document as Markdown with `<!-- page N -->` markers between pages |
| `text` | The plain text, pages separated by a blank line |
| `headings` | `{ level, text, page }` for every heading found |
| `tables` | `{ page, rows }` for every table found — `rows` is an array of cell arrays |
| `links` | Web links from the text and the PDF's link annotations |
| `metadata` | `title`, `subject`, `keywords`, `creator`, `producer`, `createdAt`, `modifiedAt`, `pdfVersion`, `language` |
| `pageCount`, `pagesRead`, `pageNumbers` | How many pages the file has and which were converted |
| `words`, `characters`, `fileBytes` | Sizes |
| `pages` | With `includePages`: `{ page, markdown, text }` per page |
| `url`, `finalUrl`, `status`, `error`, `scrapedAt` | What you gave, where it came from, and why a link gave nothing |

#### Example

```json
{
  "url": "https://arxiv.org/pdf/1706.03762",
  "finalUrl": "https://arxiv.org/pdf/1706.03762v7",
  "pageCount": 15,
  "pagesRead": 15,
  "markdown": "<!-- page 1 -->\n\n# Attention Is All You Need\n\n### Abstract\n\nThe dominant sequence transduction models are based on complex recurrent or convolutional neural networks ...\n\n---\n\n<!-- page 2 -->\n\n# 1 Introduction\n\nRecurrent neural networks ...",
  "text": "Attention Is All You Need\nAbstract\nThe dominant sequence transduction models ...",
  "headings": [
    { "level": 1, "text": "Attention Is All You Need", "page": 1 },
    { "level": 3, "text": "Abstract", "page": 1 },
    { "level": 1, "text": "1 Introduction", "page": 2 },
    { "level": 2, "text": "3.1 Encoder and Decoder Stacks", "page": 3 }
  ],
  "tables": [
    { "page": 8, "rows": [["Model", "BLEU EN-DE", "BLEU EN-FR"], ["ByteNet", "23.75", ""], ["Transformer (big)", "28.4", "41.8"]] }
  ],
  "links": ["https://github.com/tensorflow/tensor2tensor"],
  "metadata": {
    "title": null,
    "creator": "LaTeX with hyperref",
    "producer": "pdfTeX-1.40.25",
    "createdAt": "2024-04-10T21:11:43Z",
    "pdfVersion": "1.5"
  },
  "words": 9412,
  "characters": 61230,
  "fileBytes": 2215244,
  "status": "OK",
  "scrapedAt": "2026-10-19T12:34:56.000Z"
}
```

### Pricing

You are charged **per document delivered** — see the price on this page. Links that give nothing (404, not a PDF, too large, no text layer) are free. Use `pages` or `maxPages` to keep long documents cheap in compute.

### FAQ

**Is this an official API?** No, it's an unofficial API built on public pages. It reads PDFs from public links with the open-source pdf.js engine.

**Does it do OCR?** No. A scanned PDF without a text layer comes back as `NO_TEXT`, free, with a clear message. If your documents are scans, run them through an OCR step first.

**How good is the Markdown?** Headings, paragraphs, bullets and simple aligned tables come out well from text-based PDFs (papers, reports, manuals). Multi-column layouts, footnotes mixed into the body, and tables with merged cells are the hard cases — the plain `text` is always there as well.

**Can I convert a PDF I upload?** Give it a public link: upload the file to your Apify key-value store (or any public storage) and paste the link.

**What about password-protected or very large files?** Encrypted PDFs fail with a clear error; files over 100 MB are reported as `TOO_LARGE`. Both are free.

**Like it?** A short review on the Store page helps other people find this Actor. Something missing or broken? Tell us on the Issues tab — we read every one.

### Related Actors

- [PDF Text Extractor & Scraper](https://apify.com/highbrow_fame/pdf-text-extractor) — page-by-page PDF text and metadata
- [Sitemap Extractor & Scraper](https://apify.com/highbrow_fame/sitemap-url-extractor) — every URL, date and image from a sitemap
- [URL to Markdown API](https://apify.com/highbrow_fame/url-to-markdown-api) — clean Markdown from any URL for LLMs
- [Article Extractor API](https://apify.com/highbrow_fame/article-extractor-api) — title, author, date and full text of any article
- [Web Fetch API](https://apify.com/highbrow_fame/web-fetch-api) — Fetch any URL as HTML, text, Markdown or JSON

# Actor input Schema

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

Links to PDF files at public addresses, one per line. Up to 100 MB each.

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

Which pages to read, for example "1-5, 8" or "10-" (to the end). Empty: all pages.

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

markdown: the Markdown document with page markers, headings, lists and tables. text: the plain text. both: both fields.

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

Read at most this many pages of each PDF (the first ones, or the first ones of your page selection). 0: all pages, up to 2,000.

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

Also deliver a list with one entry per page (page number, Markdown and text).

## `maxTextLength` (type: `integer`):

Cut the Markdown and the text after this many characters (textTruncated is set). 0: no limit.

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

How many PDFs to read at the same time.

## `proxyConfiguration` (type: `object`):

Used only when a site turns a download down: the first try goes out directly.

## Actor input object example

```json
{
  "urls": [
    "https://arxiv.org/pdf/1706.03762"
  ],
  "outputFormat": "both",
  "maxPages": 0,
  "includePages": false,
  "maxTextLength": 0,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Every result as a JSON record, with a status for each input.

## `resultsCsv` (type: `string`):

The same records as CSV, for a spreadsheet.

# 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"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("highbrow_fame/pdf-to-markdown-api").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"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("highbrow_fame/pdf-to-markdown-api").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"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call highbrow_fame/pdf-to-markdown-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,highbrow_fame/pdf-to-markdown-api"
        }
    }
}
```

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/fAKPDLgxDll1YAchK/builds/2Xupfcoz8jHN1uiaZ/openapi.json
