# PDF Extractor: PDF to Markdown, Text & Tables (`registrydata/pdf-to-markdown-extractor`) Actor

PDFs from URLs to Markdown, text and tables per page: headings, lists, tables, two-column reading order, bookmarks and metadata. No OCR (text PDFs only). USD 2 per 1,000 pages.

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

## Pricing

$2.00 / 1,000 pages

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 Extractor: Text and Tables

Give it PDF links; get back **clean Markdown, plain text and tables, page by page**: headings (from font sizes and the document's bookmarks), paragraphs with line-break hyphenation repaired, bullet lists, tables (drawn with lines, or laid out in columns), two-column reading order, and rotated landscape pages read the right way up. Repeated headers, footers and page numbers are removed. PDF metadata (title, author, dates) and the bookmark outline come along. It uses permissively licensed libraries only (pypdf and pdfplumber), so there is no licensing trap for you or for us.

**Price: $2.00 per 1,000 pages.** Set a maximum cost per run and the run stops there. Details under [Pricing](#pricing).

You pay **$2 per 1,000 pages ($0.002 each)**, only for pages that produced text or a table. By default it converts the first three pages of two sample PDFs, so a first run needs no setup.

It does **not** do OCR: a scanned PDF (pages that are pictures) has no text to extract; those pages are reported and not billed.

### What you get

One item per PDF (`outputMode: document`), or one item per page (`outputMode: page`).

| Field | Meaning |
|---|---|
| `url`, `requested_url`, `file_size_bytes`, `sha256` | The PDF after redirects, the address you gave, its size and SHA-256 (equal hashes mean the same file) |
| `title`, `author`, `subject`, `creator`, `producer`, `created_at`, `modified_at` | PDF metadata as written in the file (dates in ISO 8601) |
| `page_count`, `pages_selected`, `pages_extracted`, `pages_billed` | Pages in the file, pages chosen, pages with content, pages billed |
| `markdown` | The document as Markdown. Pages are separated by `<!-- page N -->` comments (switch off with `includePageMarkers`) |
| `pages` | Per page: `page_number`, `markdown`, `word_count`, `warnings`, `tables` (rows of cells) and `text` when switched on |
| `outline` | The PDF's bookmarks: title, level, page |
| `table_count`, `word_count`, `warnings` | Totals and notes (`rotated_page`, `no_text_layer`, `page_limit`, `truncated_by_spending_limit`) |

In page mode each item is one page with the document's metadata, `page_number`, `markdown`, `word_count`, `warnings` and `tables`.

### Who uses it

- **AI and RAG builders:** turn reports, papers, contracts and manuals into Markdown with page numbers, ready to chunk and embed.
- **Analysts and finance teams:** pull tables out of statistical reports, filings and datasheets as rows of cells.
- **Compliance and legal teams:** convert regulatory documents and forms and keep page references.
- **Researchers:** convert two-column papers to readable text in the right order.

### Input

```json
{
  "pdfUrls": [{ "url": "https://example.com/report.pdf" }],
  "pages": "1-10",
  "outputMode": "page",
  "includeTables": true,
  "includeText": false,
  "maxPagesPerPdf": 200,
  "maxFileSizeMb": 50
}
```

| Field | Meaning |
|---|---|
| `pdfUrls` | Addresses of the PDF files. Each is read once |
| `pages` | Pages for every PDF, such as `1-5,8,10-`. Empty reads all pages (up to `maxPagesPerPdf`). You pay per page converted |
| `outputMode` | `document` (default) or `page` |
| `includeTables`, `includeText`, `includePageMarkers`, `removeRepeatedHeadersAndFooters` | Output options (tables on, text off, markers on, headers and footers removed) |
| `maxPagesPerPdf`, `maxFileSizeMb`, `timeoutSecs` | Limits per PDF (200 pages, 50 MB, 120 seconds). A PDF over a limit is stopped and not billed |
| `maxConcurrency`, `requestDelayMs` | PDFs converted at once (default 3) and the minimum gap per site (default 250 ms) |

### Output sample

Real item from a test run in page mode (every field, page 2 of the IRS Form W-9, `includeText` off):

```json
{
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "requested_url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "title": "Form W-9 (Rev. March 2024)",
  "author": "SE:W:CAR:MP",
  "subject": "Request for Taxpayer Identification Number and Certification",
  "creator": "Designer 6.5",
  "producer": "Designer 6.5",
  "created_at": "2024-03-06T08:18:13Z",
  "modified_at": "2024-03-06T08:18:13Z",
  "page_count": 6,
  "file_size_bytes": 140815,
  "sha256": "2d420cbb4123dcf1fb82595b2359cfbb5d81f00b9df9d359fcc7af361d093f53",
  "status_code": 200,
  "extracted_at": "2026-11-22T10:34:35+00:00",
  "page_number": 2,
  "markdown": "Form W-9 (Rev. 3-2024)\n\nmust obtain your correct taxpayer identification number (TIN), which may be your social security number (SSN), individual taxpayer identification number (ITIN), adoption taxpayer identification number (ATIN), or employer identification number (EIN), to report on an information return the amount paid to you, or other amount reportable on an information return. Examples of information returns include, but are not limited to, the following.\n\n- Form 1099-INT (interest earned or paid).\n\n- Form 1099-DIV (dividends, including those from stocks or mutual funds).\n\n- Form 1099-MISC (various types of income, prizes, awards, or gross proceeds).\n\n- Form 1099-NEC (nonemployee compensation).\n\n- Form 1099-B (stock or mutual fund sales and certain other transactions by brokers).\n\n- Form 1099-S (proceeds from real estate transactions).\n\n- Form 1099-K (merchant card and third-party network transactions).\n\n- Form 1098 (home mortgage interest), 1098-E (student loan interest), and 1098-T (tuition).\n\n- Form 1099-C (canceled debt).\n\n- Form 1099-A (acquisition or abandonment of secured property). Use Form W-9 only if you are a U.S. person (including a resident alien), to provide your correct TIN. Caution: If you don’t return Form W-9 to the requester with a TIN, you might be subject to backup withholding. See What is backup withholding, later. By signing the filled-out form, you:\n\n1. Certify that the TIN you are giving is correct (or you are waiting for a number to be issued);\n\n2. Certify that you are not subject to backup withholding; or\n\n3. Claim exemption from backup withholding if you are a U.S. exempt payee; and\n\n4. Certify to your non-foreign status for purposes of withholding under chapter 3 or 4 of the Code (if applicable); and\n\n5. Certify that FATCA code(s) entered on this form (if any) indicating that you are exempt from the FATCA reporting is correct. See What Is FATCA Reporting, later, for further information. Note: If you are a U.S. person and a requester gives you a form other than Form W-9 to request your TIN, you must use the requester’s form if it is substantially similar to this Form W-9. Definition of a U.S. person. For federal tax purposes, you are considered a U.S. person if you are:\n\n- An individual who is a U.S. citizen or U.S. resident alien;\n\n- A partnership, corporation, company, or association created or organized in the United States or under the laws of the United States;\n\n- An estate (other than a foreign estate); or\n\n- A domestic trust (as defined in Regulations section 301.7701-7).\n\n#### Establishing U.S. status for purposes of chapter 3 and chapter 4\n\nwithholding. Payments made to foreign persons, including certain distributions, allocations of income, or transfers of sales proceeds, may be subject to withholding under chapter 3 or chapter 4 of the Code (sections 1441–1474). Under those rules, if a Form W-9 or other certification of non-foreign status has not been received, a withholding agent, transferee, or partnership (payor) generally applies presumption rules that may require the payor to withhold applicable tax from the recipient, owner, transferor, or partner (payee). See Pub. 515, Withholding of Tax on Nonresident Aliens and Foreign Entities. The following persons must provide Form W-9 to the payor for purposes of establishing its non-foreign status.\n\n- In the case of a disregarded entity with a U.S. owner, the U.S. owner of the disregarded entity and not the disregarded entity.\n\n- In the case of a grantor trust with a U.S. grantor or other U.S. owner, generally, the U.S. grantor or other U.S. owner of the grantor trust and not the grantor trust.\n\n- In the case of a U.S. trust (other than a grantor trust), the U.S. trust and not the beneficiaries of the trust. See Pub. 515 for more information on providing a Form W-9 or a certification of non-foreign status to avoid withholding.\n\nPage\n\nForeign person. If you are a foreign person or the U.S. branch of a foreign bank that has elected to be treated as a U.S. person (under Regulations section 1.1441-1(b)(2)(iv) or other applicable section for chapter 3 or 4 purposes), do not use Form W-9. Instead, use the appropriate Form W-8 or Form 8233 (see Pub. 515). If you are a qualified foreign pension fund under Regulations section 1.897(l)-1(d), or a partnership that is wholly owned by qualified foreign pension funds, that is treated as a non-foreign person for purposes of section 1445 withholding, do not use Form W-9. Instead, use Form W-8EXP (or other certification of non-foreign status). Nonresident alien who becomes a resident alien. Generally, only a nonresident alien individual may use the terms of a tax treaty to reduce or eliminate U.S. tax on certain types of income. However, most tax treaties contain a provision known as a saving clause. Exceptions specified in the saving clause may permit an exemption from tax to continue for certain types of income even after the payee has otherwise become a U.S. resident alien for tax purposes. If you are a U.S. resident alien who is relying on an exception contained in the saving clause of a tax treaty to claim an exemption from U.S. tax on certain types of income, you must attach a statement to Form W-9 that specifies the following five items.\n\n1. The treaty country. Generally, this must be the same treaty under which you claimed exemption from tax as a nonresident alien.\n\n2. The treaty article addressing the income.\n\n3. The article number (or location) in the tax treaty that contains the saving clause and its exceptions.\n\n4. The type and amount of income that qualifies for the exemption from tax.\n\n5. Sufficient facts to justify the exemption from tax under the terms of the treaty article. Example. Article 20 of the U.S.-China income tax treaty allows an exemption from tax for scholarship income received by a Chinese student temporarily present in the United States. Under U.S. law, this student will become a resident alien for tax purposes if their stay in the United States exceeds 5 calendar years. However, paragraph 2 of the first Protocol to the U.S.-China treaty (dated April 30, 1984) allows the provisions of Article 20 to continue to apply even after the Chinese student becomes a resident alien of the United States. A Chinese student who qualifies for this exception (under paragraph 2 of the first Protocol) and is relying on this exception to claim an exemption from tax on their scholarship or fellowship income would attach to Form W-9 a statement that includes the information described above to support that exemption. If you are a nonresident alien or a foreign entity, give the requester the appropriate completed Form W-8 or Form 8233.\n\n#### Backup Withholding\n\nWhat is backup withholding? Persons making certain payments to you must under certain conditions withhold and pay to the IRS 24% of such payments. This is called “backup withholding.” Payments that may be subject to backup withholding include, but are not limited to, interest, tax-exempt interest, dividends, broker and barter exchange transactions, rents, royalties, nonemployee pay, payments made in settlement of payment card and third-party network transactions, and certain payments from fishing boat operators. Real estate transactions are not subject to backup withholding. You will not be subject to backup withholding on payments you receive if you give the requester your correct TIN, make the proper certifications, and report all your taxable interest and dividends on your tax return. Payments you receive will be subject to backup withholding if:\n\n1. You do not furnish your TIN to the requester;\n\n2. You do not certify your TIN when required (see the instructions for Part II for details);\n\n3. The IRS tells the requester that you furnished an incorrect TIN;\n\n4. The IRS tells you that you are subject to backup withholding because you did not report all your interest and dividends on your tax return (for reportable interest and dividends only); or\n\n5. You do not certify to the requester that you are not subject to backup withholding, as described in item 4 under “By signing the filledout form” above (for reportable interest and dividend accounts opened after 1983 only).",
  "word_count": 1409,
  "warnings": [],
  "tables": [],
  "pages_billed": 1
}
```

### Pricing

Pay per page: **$2.00 per 1,000 pages** converted. A page counts when it produced text or a table; blank pages, scanned pages and pages that fail are not billed. A default run (6 pages) costs about one cent. A 200-page report costs $0.40. Documents that are encrypted, over the size limit, not PDFs, blocked by robots.txt or slower than the time limit are **never billed**. Your spending limit is respected to the page: the run stops at the last page it covers.

### How good is the extraction?

We converted 10 real PDFs (two-column papers, a specification, statistical reports with tables, a datasheet, government forms) and compared the words with poppler's `pdftotext`, a reference tool for reading order. Word recall averaged **0.96** and precision **0.99**, against recall 0.99 and precision 0.97 for plain pypdf text and recall 0.95 and precision 0.98 for plain pdfminer text; the Markdown converter markitdown scored recall 0.71 on the six whole documents it could be run on. Plain-text extractors keep slightly more raw words because they do not separate headings and tables; this Actor adds the structure (headings, lists, tables, column order). About 0.1 second per page. The pages, method and caveats are in the project report.

### Limits and honest notes

- **No OCR.** Scanned documents (page images without text) give `no_text_layer` and no charge. Use an OCR service first.
- **Tables** are found where lines are drawn and where text sits in aligned columns. Complex tables (merged cells, nested tables, tables without clear columns) can come out as ordinary text or with cells joined; the words are kept either way. Tables on rotated pages are read as text lines.
- **Layout** is heuristic: one- and two-column pages are ordered correctly; three or more columns, sidebars and text boxes may not be. Headings come from font size and bookmarks; documents that style headings only by colour or spacing may show them as plain paragraphs. Bold and italics inside paragraphs are not marked.
- **Maths and figures:** equations come out as the text characters the PDF holds (often garbled), and figures are not described. Text inside figures appears if it is real text.
- **Encrypted PDFs** that open without a password work; ones that need a password are reported and not billed. Hostile or enormous files are stopped by the time, size and page limits; each PDF is processed in its own process so one bad file cannot stop the run.
- **robots.txt is always honored**, the Actor identifies itself as `PdfExtractor/1.0 (+Apify Actor; honors robots.txt)`, and addresses on private networks, numeric forms such as `0177.0.0.1` and names that cannot be resolved are refused at every redirect.
- Converting a document is your responsibility: respect the publisher's terms and copyright.

### FAQ

**Can I read a PDF I uploaded?** Give a public link; files behind logins are not supported.

**Can I use it through the API or an AI agent?** Yes, like any Apify Actor: start it with the Apify API, client libraries or MCP, then read the dataset.

# Actor input Schema

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

Addresses of the PDF files. Each is read once.

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

Pages to convert in every PDF, for example 1-5,8,10-. Empty means all pages (up to the page limit). You pay per page converted.

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

Page mode returns one dataset item per page, ready for indexing.

## `includeTables` (type: `boolean`):

Detect tables (drawn with lines, or text laid out in columns) and return them as Markdown tables and as rows of cells.

## `includeText` (type: `boolean`):

Add a plain-text version.

## `includePageMarkers` (type: `boolean`):

Separate pages in the document Markdown with  comments.

## `removeRepeatedHeadersAndFooters` (type: `boolean`):

Drop running headers, footers and page numbers that repeat on most pages.

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

Pages beyond this are not read. Caps your cost.

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

Larger files are skipped and not billed.

## `timeoutSecs` (type: `integer`):

A PDF that takes longer is stopped and not billed.

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

PDFs converted in parallel.

## `requestDelayMs` (type: `integer`):

Minimum time between requests to one site. A robots.txt Crawl-delay raises it. robots.txt is always honored.

## Actor input object example

```json
{
  "pdfUrls": [
    {
      "url": "https://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf"
    },
    {
      "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
    }
  ],
  "pages": "1-3",
  "outputMode": "document",
  "includeTables": true,
  "includeText": false,
  "includePageMarkers": true,
  "removeRepeatedHeadersAndFooters": true,
  "maxPagesPerPdf": 200,
  "maxFileSizeMb": 50,
  "timeoutSecs": 120,
  "maxConcurrency": 3,
  "requestDelayMs": 250
}
```

# Actor output Schema

## `results` (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://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf"
        },
        {
            "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
        }
    ],
    "pages": "1-3"
};

// Run the Actor and wait for it to finish
const run = await client.actor("registrydata/pdf-to-markdown-extractor").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://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf" },
        { "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf" },
    ],
    "pages": "1-3",
}

# Run the Actor and wait for it to finish
run = client.actor("registrydata/pdf-to-markdown-extractor").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://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf"
    },
    {
      "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
    }
  ],
  "pages": "1-3"
}' |
apify call registrydata/pdf-to-markdown-extractor --silent --output-dataset

```

## MCP server setup

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

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/ig7LXIBpv1VmXQSB6/builds/0uLi9BhdiXMjc1mN3/openapi.json
