# PDF to Markdown Extractor: Page Numbers & Tables (`kizukidata/pdf-to-markdown`) Actor

PDF to Markdown extractor: convert PDF to Markdown and plain text from URLs with Page N markers, headings, tables, and links for RAG and LLM pipelines. No OCR: fully scanned PDFs and failed downloads are free.

- **URL**: https://apify.com/kizukidata/pdf-to-markdown.md
- **Developed by:** [Kizuki](https://apify.com/kizukidata) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.09 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

### What does PDF to Markdown Extractor do?

Convert PDF to Markdown and plain text from direct PDF URLs: one row per file with `## Page N` markers, headings, tables, and links ready for RAG pipelines, LLMs, and searchable citations.

Empty input (`{}`) converts two small sample PDFs in about three seconds.

### Use cases

- **Material for RAG and LLMs.** Page markers stay in the text, so a retrieved passage can be cited by page.
- **Contracts, reports and papers, searchable.** Turn a folder of PDFs into one searchable table without opening
  each file.
- **Audit a document folder.** `pagesNeedingOcr` tells you which pages are scans before you spend on OCR.
- **A Markdown wiki or knowledge base.** Headings, lists, tables and links come out as Markdown, not as a wall of
  text.
- **Reading for AI agents.** One call returns one row per PDF, so an agent can branch on `status` instead of
  parsing an error.

### What data can you get?

| Field | Description |
|---|---|
| `id` | Stable document ID (a hash of the URL) |
| `url`, `finalUrl` | The PDF URL you gave, and where it was actually served from |
| `title` | Title from the PDF metadata, when the file has one |
| `status` | `ok` when the text layer gave text; `scan` when every page is a scan (no text, or only a page number or a stamp); `failed` when the file could not be downloaded. `scan` and `failed` rows are written and not charged |
| `pdfType` | How the converter classified the file: `TextBased`, `Scanned`, `Mixed` or `ImageBased` |
| `pageCount`, `pagesReturned` | Pages in the file, and pages included in the output (at most `maxPages`) |
| `pagesNeedingOcr` | 1-indexed pages of the returned set that are scans and need OCR. A page is listed when it has no text, or when its text is short (under 50 characters) and it draws a full-page image, or its text sits only in the header or footer (a running head, a page number, a stamp). A short page of a normal document (a chapter's last lines, a caption) is not listed. The text that was read stays in `markdown`, with a one-line note under a listed page |
| `markdown` | The document: `# Title` (if any), then `## Page 1`, `## Page 2`, … with headings, lists, tables and links kept |
| `text` | The same text without Markdown, with a `Page N` line before each page |
| `charCount`, `byteCount` | Size of the text, and of the downloaded file |
| `truncated` / `truncatedBy` | Whether a cap cut the document, and which one (`pages`, `chars`, or `null`) |
| `error` | On a `failed` row, a fixed sentence saying why the file could not be converted (`null` otherwise) |
| `scrapedAt` | When the document was converted |

Every row has every field; a value the file does not provide is `null`.

### How to use PDF to Markdown Extractor

1. Copy the **file URL** of each PDF (the address ends in `.pdf` or serves the file directly — not a page that
   shows a PDF viewer).
2. Paste the URLs into **PDF URLs** (`pdfUrls`), one per entry.
3. Optionally set **Maximum PDFs** (`maxItems`), **Maximum pages per PDF** (`maxPages`), **Maximum file size** and **Maximum characters per
   PDF**.
4. Run the Actor and read the dataset, or take the `markdown` field of each row.

For web pages instead of PDFs, URL to Markdown does the same without a browser.

#### Input example

```json
{
    "pdfUrls": [
        "https://example.com/annual-report-2025.pdf",
        "https://example.com/whitepaper.pdf"
    ],
    "maxPages": 100,
    "maxItems": 10
}
```

### Input

| Field | Default | Meaning |
|---|---|---|
| `pdfUrls` | two small public sample PDFs | The PDF URLs to convert, one per entry |
| `maxItems` | 5 | **Maximum PDFs** per run; the same number also stops the work, so PDFs beyond it are not downloaded |
| `maxPages` | 100 (at most 500) | **Maximum pages per PDF**; a longer document returns its first pages and sets `truncated: true` while `pageCount` reports the real length |
| `maxMbPerFile` | 50 (at most 50) | **Maximum file size** in MB; a larger file is not converted and is listed in OUTPUT `skippedInputs`. The run also needs memory for the file: with the default 1 GB, files up to about 40 MB are converted, and a file up to the 50 MB limit needs **Memory** raised to 2 GB. A run does not start below 1 GB |
| `maxChars` | 400000 (at most 500000) | **Maximum characters per PDF**, the text budget for one document |
| `respectRobotsTxt` | true | **Respect robots.txt**; a path a host disallows for this Actor is not returned and not charged |

### Output

One row per PDF (the default dataset):

```json
{
    "id": "e3bfe299b5d790a7",
    "source": "pdf",
    "url": "https://example.com/annual-report-2025.pdf",
    "finalUrl": "https://example.com/annual-report-2025.pdf",
    "title": "Annual report 2025",
    "status": "ok",
    "pdfType": "TextBased",
    "pageCount": 48,
    "pagesReturned": 48,
    "pagesNeedingOcr": [],
    "markdown": "# Annual report 2025\n\n## Page 1\n\nLetter to shareholders\n…",
    "text": "Page 1\nLetter to shareholders\n…",
    "charCount": 118422,
    "byteCount": 2384190,
    "truncated": false,
    "truncatedBy": null,
    "error": null,
    "scrapedAt": "2026-11-04T09:00:00.000Z"
}
```

#### What is kept, and what is not

- **Page numbers** are part of the output: `## Page N` in the Markdown, `Page N` in the text.
- **The text layer as the file stores it.** The converter keeps the reading order of the page; a two-column
  report is read column by column instead of being interleaved.
- **Structure where the file has it.** Headings, lists, tables, links, bold and italic come out as Markdown; the
  converter's headings sit two levels below the page marker (`## Page N`), so a page's own `#` heading becomes
  `###`.
- **CJK and other non-Latin scripts** are decoded through the file's own font maps; a page whose text cannot be
  decoded is listed in `pagesNeedingOcr` instead of coming back garbled.
- **No OCR.** A scan is returned with `status: "scan"` and its pages in `pagesNeedingOcr`, and it is not charged;
  to read it, run it through an OCR tool first. A page whose text is only a page number or a stamp, or a page that
  draws a full-page image under 50 characters, is treated the same way: it is listed in `pagesNeedingOcr`, its
  text is kept, and `_Little or no text layer on this page; it may be a scan (OCR needed)._` is added under it. A
  short page of a normal document (a chapter's last lines, a caption) is not listed and not marked.
- **No images, no form fields.** Images and form widgets are not returned; only their text is.
- **Encrypted PDFs** are skipped with the reason `the PDF could not be read (broken or encrypted file)`.

### How much does it cost?

PDF to Markdown Extractor uses **pay-per-event** pricing: you pay for the documents it converts, not for the time it runs.

| Apify plan (discount tier) | Price per 1,000 PDFs | Price per PDF |
|---|---|---|
| **Free** | $1.60 | $0.0016 |
| **Starter (Bronze)** | $1.45 | $0.00145 |
| **Scale (Silver)** | $1.31 | $0.00131 |
| **Business (Gold)** | $1.09 | $0.00109 |

Apify's Free plan includes USD 5 of monthly usage, which covers about 3,125 PDFs at the Free tier price, run
start fees aside.

- **Run start fee**: USD 0.00005 per GB of memory per run (USD 0.00005 at this Actor's default 1 GB).
- A PDF is charged once, whether it is 1 page or 500.
- **A URL that produced no converted document is not charged**: an invalid URL, a page that is not a PDF, an
  unreadable file, or a path disallowed by robots.txt is listed in the run's `OUTPUT` record and costs nothing. A
  file that could not be downloaded (a timeout, a body above the Actor's absolute limit) comes back as an
  uncharged `failed` row; a scan comes back as an uncharged `scan` row.
- The empty-input sample (two small PDFs) costs about $0.0032 on the Free plan.
- **Maximum PDFs** and your run's maximum cost cap the charge.

### Use with AI agents (MCP)

PDF to Markdown Extractor works as a tool for AI agents such as Claude, Cursor and n8n agents through the Apify MCP server. Load this Actor, plus the tool that reads its input schema and pricing, with this server URL:

```text
https://mcp.apify.com?tools=fetch-actor-details,kizukidata/pdf-to-markdown
```

- **Claude Code**: run `claude mcp add apify "https://mcp.apify.com?tools=fetch-actor-details,kizukidata/pdf-to-markdown" -t http`.
- **Claude (web or desktop app)**: open **Customize → Connectors**, choose **Add custom connector**, name it `Apify` and paste the server URL above.
- **Cursor**: add the server to `~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project):

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

- **n8n**: add the Apify node (on self-hosted n8n, install the community package `@apify/n8n-nodes-apify`) and choose **Run an Actor and get dataset**; for an n8n AI Agent, add **Apify Tool** as a tool.

The server signs you in to Apify with OAuth. A client that cannot use OAuth can send your Apify API token in an `Authorization: Bearer <APIFY_TOKEN>` header instead.

#### What to send from an agent

- Calling it with **no arguments** (`{}`) converts two small sample PDFs and finishes in about three seconds.
- Pass `pdfUrls` and, if you need shorter output for a small context, `maxChars`.
- Every URL you send comes back as exactly one row (or is listed as skipped in `OUTPUT`), so an agent can branch
  on `status` instead of parsing an error.

### Integrations and API

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/kizukidata~pdf-to-markdown/runs" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"pdfUrls":["https://example.com/report.pdf"],"maxItems":10}'
```

Poll `GET https://api.apify.com/v2/actor-runs/<RUN_ID>` for the status, read `defaultDatasetId`, then fetch
`GET https://api.apify.com/v2/datasets/<DATASET_ID>/items?format=json`.

#### n8n, Make and Zapier

Use the Apify integration, choose **Run Actor**, pass the URL list, then **Get dataset items**. A schedule over a
folder of filings turns each new PDF into one Markdown row.

### Limitations

- **Independent tool, no login.** Not affiliated with, endorsed by or sponsored by any of the sites whose documents you convert. Needs no login or account.
- **No OCR, no layout reconstruction.** Scanned PDFs without a text layer are not charged and return `pagesNeedingOcr` (including scanned pages with page numbers/header stamps or full-page figure images; short normal text pages are not flagged). Scanned pages carry a one-line note, and extracted text is kept within `maxChars`. The text is only as good as the PDF's text layer; a scan is reported, not
  read.
- **One request per PDF.** A server that requires a login, a CAPTCHA or JavaScript to serve the file can not be
  read; a redirect to a login page is reported as `the response was not a PDF`.
- **Files over `maxMbPerFile` are not converted**: they are listed in OUTPUT `skippedInputs` and not charged (a
  body above the Actor's absolute limit comes back as an uncharged `failed` row).
- **A big file needs memory.** The converter works on the whole file at once. With the default 1 GB, files up to
  about 40 MB are converted; a larger file (up to the 50 MB limit) is skipped with a reason that names the memory
  it needs, instead of failing the run. Raise **Memory** to 2 GB for the largest files. Runs do not start below
  1 GB.
- **Only `http` and `https` URLs** are accepted, and local and private addresses are refused (loopback, private
  ranges, link-local) so the Actor can not be pointed at the platform's internal network.
- **No links are followed.** The Actor reads exactly the URLs you give it, once each, and does not crawl.

#### Run status and the OUTPUT record

Each run ends with a short status message and writes an `OUTPUT` record to its key-value store with the counts
(requests, documents read, documents returned, blocked requests) and:

- `skippedInputs`: entries that were invalid, duplicated, not a PDF, too large, unreadable, too large for this
  run's memory, disallowed by robots.txt, or over `maxItems`, with their position in your list and the reason.
  None of them is charged;
- `uncheckedInputs`: entries the run did not reach because it stopped first (no budget left, or the site refused
  too many requests). Entries over `maxItems` are in `skippedInputs`, not here.

A run **succeeds** whenever it accounts for every URL you listed: a file that is not a PDF, or a page the site
disallows, is skipped with a reason; a scan comes back as an uncharged `scan` row; a download that failed, or a URL
that did not answer at all, comes back as an uncharged `failed` row with a fixed reason. A run is marked **FAILED**
only when the Actor itself hit an unexpected error; its log has the details, and an Issue with the run ID helps.

The run's `code` names why a run returned nothing. A URL that answers 404 or 410, or a response that is not a PDF,
is `input_not_found`; a run whose every URL was too large for the memory it was given is `insufficient_memory`
(raise **Memory** and run again, though the file can still fail for another reason). Both are successful runs and
charge nothing.

### FAQ

#### Can it read a scanned PDF?

It returns the row, but with no text: `status` is `scan`, `pagesNeedingOcr` lists the pages, and the row is not
charged. A scan whose pages carry a printed page number or a header stamp is recognised the same way: a short page
that draws a full-page image, or whose text sits only in the header or footer, is reported as needing OCR. The
short text that was read is kept, with `_Little or no text layer on this page; it may be a scan (OCR needed)._`
under it. A short page of a normal document (the last lines of a chapter, a caption) is not a scan and is not
marked. OCR needs a separate tool; the Actor never invents text.

#### Why is my PDF skipped?

Check the `OUTPUT` record: the reason is listed next to the entry's position. The most common causes are a landing
page instead of the file (the response was not a PDF), a file above the size limit, and robots.txt.

#### Why was a large PDF skipped with a memory reason?

The converter holds the whole file while it reads it. With the default 1 GB, a file up to about 40 MB is converted;
a larger one (the file limit, `maxMbPerFile`, is 50 MB) is skipped with a reason that names the memory it needs.
Re-run with **Memory** set to 2 GB; a file can still be skipped or fail for another reason.

#### Why is a PDF shorter than the original?

Check `truncated` and `truncatedBy`. **Maximum pages** cuts at `maxPages` (up to 500) and **Maximum characters**
at `maxChars` (up to 500000); `pageCount` and `charCount` still report the real size.

#### Does it keep the page numbers for citations?

Yes. `markdown` carries `## Page N` before each page and `text` carries `Page N`, so a chunk or a citation can
name the page it came from.

#### Is it legal to use this data?

The Actor fetches the document you point it at, once, the same way a browser would. How you use the text is your
responsibility; check the terms that apply to your documents and to the sites you read, and handle personal data
in line with the law where you operate (for example GDPR or CCPA). This is not legal advice.

### Related Kizuki Actors

Other Actors from Kizuki that work well with this one:

- [URL to Markdown](https://apify.com/kizukidata/url-to-markdown) — clean Markdown from web pages instead of files, for the same RAG pipeline.
- [YouTube Transcript Scraper](https://apify.com/kizukidata/youtube-transcripts) — transcripts with timestamps and chunks, the video side of the same corpus.

### Your feedback

Found a PDF that converts badly? Open an Issue in this Actor's Issues tab with the run ID and, if the file is
public, its URL. If you run a site and do not want your documents read, name the URL pattern in an Issue; runs
then skip it without sending a request and list it in the `OUTPUT` record as `excluded at the site owner's
request`.

# Actor input Schema

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

Up to 100 direct PDF file URLs (not HTML viewer pages). Leaving empty converts 2 sample PDFs (converted document rows are charged; failed downloads are free). Local/private IPs refused.

## `maxItems` (type: `integer`):

Max PDFs to convert per run (1-100, default 5). Each converted PDF is charged; PDFs beyond the cap are listed in OUTPUT skippedInputs.

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

Max pages read per PDF (1-500, default 100). Longer PDFs return the first pages and set truncated: true; pageCount shows full length.

## `maxMbPerFile` (type: `integer`):

Max PDF size in MB (1-50, default 50; oversized files are free). Default 1 GB RAM converts up to ~40 MB; raise to 2 GB for 50 MB (min 1 GB).

## `maxChars` (type: `integer`):

Character cap for Markdown and text per PDF (1000-500000, default 400000). Longer output is cut with truncated: true.

## `respectRobotsTxt` (type: `boolean`):

true (default) skips PDFs disallowed by robots.txt (listed in OUTPUT, free); false ignores robots.txt (use only when allowed).

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

Leave empty or {} for direct connection. Set {"useApifyProxy": true} for Apify datacenter proxy (no residential proxies).

## Actor input object example

```json
{
  "pdfUrls": [
    "https://pdfobject.com/pdf/sample.pdf",
    "https://www.orimi.com/pdf-test.pdf"
  ],
  "maxItems": 5,
  "maxPages": 100,
  "maxMbPerFile": 50,
  "maxChars": 400000,
  "respectRobotsTxt": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

PDFs returned by this run, with their Markdown and text.

## `runSummary` (type: `string`):

Status code (insufficient_memory when every file was larger than this run's memory allows), counters, and the input entries that were skipped or not checked.

# 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": [
        "https://pdfobject.com/pdf/sample.pdf",
        "https://www.orimi.com/pdf-test.pdf"
    ],
    "maxItems": 5,
    "maxPages": 100,
    "maxMbPerFile": 50,
    "maxChars": 400000,
    "respectRobotsTxt": true,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kizukidata/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": [
        "https://pdfobject.com/pdf/sample.pdf",
        "https://www.orimi.com/pdf-test.pdf",
    ],
    "maxItems": 5,
    "maxPages": 100,
    "maxMbPerFile": 50,
    "maxChars": 400000,
    "respectRobotsTxt": True,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("kizukidata/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": [
    "https://pdfobject.com/pdf/sample.pdf",
    "https://www.orimi.com/pdf-test.pdf"
  ],
  "maxItems": 5,
  "maxPages": 100,
  "maxMbPerFile": 50,
  "maxChars": 400000,
  "respectRobotsTxt": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call kizukidata/pdf-to-markdown --silent --output-dataset

```

## MCP server setup

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