# PDF to Markdown with Tables for AI Agents (`fluidfaith/pdf-to-markdown-tables`) Actor

Convert PDF, Word, PowerPoint and Excel files to clean Markdown plus every table as JSON rows and headers, page by page, with OCR for scanned pages. Built for AI agents and RAG: JSON in, JSON out, works through Apify's MCP server. $0.002 per page.

- **URL**: https://apify.com/fluidfaith/pdf-to-markdown-tables.md
- **Developed by:** [FFS Marketing](https://apify.com/fluidfaith) (community)
- **Categories:** AI, Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 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/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

**Turn any PDF, Word, PowerPoint or Excel file into clean Markdown and real tables your AI agent can use.** Give it a link; get back Markdown plus every table as JSON rows and headers, page by page. Scanned pages are read with OCR automatically.

**Works as a tool for AI agents.** Add it to Claude, ChatGPT, Cursor or any MCP client through Apify's MCP server (`https://mcp.apify.com?tools=fluidfaith/pdf-to-markdown-tables`), or call it with one API request. JSON in, JSON out.

**Costs $0.008 per document, $0.002 per page and $0.002 per table** ($0.01 per scanned page). A 10-page PDF with 2 tables is $0.032. Failed files are free, and your maximum charge per run is never exceeded.

### Why use it

#### Tables come back as data, not flattened text

Most PDF tools pour a table into a stream of numbers with the columns lost. This Actor finds each table, keeps its rows and columns, and returns it as `headers` and `rows` you can load straight into code, plus a Markdown copy. Multi-row headers are flattened into one readable header row ("Sales / Total"). When the table model merges tightly packed rows, the Actor rebuilds them from the page's own text so each line of the source table is one row.

#### PDF, Word, PowerPoint and Excel in the same call

Send a mix of `.pdf`, `.docx`, `.pptx` and `.xlsx` links. The type is detected from the file itself, not the extension. Each slide and each sheet counts as a page.

#### Safe for agent context windows

Every result has a `tokenEstimate`. Long documents are not pushed into your agent's context: Markdown over the limit you set (`inlineMarkdownMaxChars`, default 200,000 characters) is returned as a link (`markdownUrl`) instead. Ask for `chunks` and you get RAG-ready pieces of about the size you choose, each with its page numbers.

#### Tested accuracy

We hand-checked 9,055 table cells in 10 public US government PDFs (Census Bureau, IRS, NIST) and compared against Microsoft's markitdown on the same files:

| Test set | This Actor | markitdown (tables only) | markitdown (any text line, generous) |
|---|---|---|---|
| Born-digital PDF tables (9,055 cells) | 97.7% | 0% (no tables found) | 54.0% |
| Scanned PDF tables, OCR (3,504 cells) | 79.6% | 0% (no text) | 0% |
| Word, PowerPoint, Excel tables (615 cells) | 100% | 100% | 100% |
| Body text words found, born-digital | 98.0% | n/a | 99.9% |

Cell accuracy is an exact match after trimming whitespace. Full method in the Accuracy section.

### Input

| Field | Default | What it does |
|---|---|---|
| `urls` | required unless `files` given | Public http(s) links to .pdf, .docx, .pptx or .xlsx files (up to 200). |
| `files` | `[]` | Up to 5 files as `{ "name": "report.pdf", "base64": "..." }`, 10 MB each, for agents that already hold the file. |
| `pages` | all | Page range for PDFs and slides, for example `"1-5,8"`. |
| `maxPagesPerDocument` | 200 | 1 to 2000. Pages beyond it are skipped, listed and not charged. |
| `ocr` | `auto` | `auto` reads only pages without a text layer with OCR; `off`; `force` (every page billed as scanned). |
| `ocrLanguages` | `["eng"]` | Tesseract codes. Shipped: eng, spa, fra, deu, por, ita. |
| `tableMode` | `accurate` | `fast` is quicker, slightly less precise. |
| `tablesAs` | `both` | Each entry in `tables` as `json`, `markdown` or `both`. Tables are always inline in the Markdown too. |
| `perPage` | `false` | Also return `pages[]`, each page's Markdown. |
| `chunkTokens` | `0` | 200 to 8000: also return `chunks[]` of about that many tokens, with page numbers. |
| `inlineMarkdownMaxChars` | 200000 | Longer Markdown is only available at `markdownUrl`. |
| `maxConcurrency` | 2 | Documents converted at the same time (1 to 4). |

### Output

One dataset row per document:

```json
{
  "source": "https://www.census.gov/retail/mrts/www/data/pdf/ec_current.pdf",
  "fileName": "ec_current.pdf",
  "fileType": "pdf",
  "status": "OK",
  "error": null,
  "pageCount": 3,
  "pagesConverted": 3,
  "pagesSkipped": [],
  "ocrPages": [],
  "title": "QUARTERLY RETAIL E-COMMERCE SALES 2 nd QUARTER 2026",
  "tokenEstimate": 3068,
  "markdown": "## QUARTERLY RETAIL E-COMMERCE SALES ...",
  "markdownUrl": "https://api.apify.com/v2/key-value-stores/<id>/records/ec-current-pdf-998461.md?signature=<signature>",
  "tables": [
    {
      "index": 0,
      "page": 2,
      "caption": null,
      "headers": ["Quarter", "Retail Sales (millions of dollars) / Total", "Retail Sales (millions of dollars) / E-commerce"],
      "rows": [["2nd quarter 2026(p)", "1,986,488", "340,244"], ["1st quarter 2026(r)", "1,929,759", "327,861"]],
      "nRows": 12,
      "nCols": 8,
      "markdown": "| Quarter | Retail Sales (millions of dollars) - Total | ... |"
    }
  ],
  "pages": null,
  "chunks": null,
  "charged": { "documents": 1, "pages": 3, "ocrPages": 0, "usd": 0.01 },
  "warnings": []
}
```

`status` is `OK`, `PARTIAL` (some pages failed or your spending limit was reached mid-document; only converted pages are charged) or `ERROR` (nothing converted, nothing charged, `error` says why). A run summary is saved as the `OUTPUT` record: documents, OK, partial and error counts, pages charged, total charged and whether the run stopped at your spending limit.

### Use it from an agent

#### Any MCP client

Add Apify's MCP server with this Actor as a tool: `https://mcp.apify.com?tools=fluidfaith/pdf-to-markdown-tables`. Your agent can then call it with a list of links.

#### Claude Desktop

Settings > Connectors > Add custom connector, paste the MCP URL above and sign in to Apify. Then ask: "Read this PDF and give me the tables: <link>".

#### Claude Code

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=fluidfaith/pdf-to-markdown-tables" --header "Authorization: Bearer $APIFY_TOKEN"
```

#### One API request

```bash
curl -X POST "https://api.apify.com/v2/acts/fluidfaith~pdf-to-markdown-tables/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://www.census.gov/retail/mrts/www/data/pdf/ec_current.pdf"], "tablesAs": "json"}'
```

### Pricing

| Event | Price | Charged when |
|---|---|---|
| Document converted | $0.008 | once per document that converts at least one page |
| Page converted | $0.002 | each page read from its text layer (a slide or a sheet is a page; a Word page is 3,000 characters of output) |
| Scanned page (OCR) | $0.01 | each page read with OCR, instead of the page price |
| Table extracted | $0.002 | each table returned as JSON rows and headers; tables past your maximum charge are returned free |

Examples: a 10-page text PDF with no tables costs $0.028, with 2 tables $0.032; a 3-page scanned letter $0.038; a 40-slide deck with no tables $0.088. Apify also adds its standard run start fee ($0.00005). Failed downloads, unsupported files, blocked links, errors and pages that return no text are free. Set a maximum charge on the run and the Actor converts only the pages that fit, marks the rest as skipped and never goes over it.

### Accuracy

Born-digital set: 10 public-domain US government PDFs (Census Bureau economic indicator releases, IRS Form W-4 2026, a NIST SP 811 conversion table that spans two pages). Every body cell of every table was labeled from the PDF's own text and checked by eye: 9,055 cells. Scanned set: 5 of those PDFs rasterized to image-only pages at 200 dpi (3,504 cells). Office set: 5 Word, 3 PowerPoint and 3 Excel files we generated with known tables (615 cells).

| Measure | Result | Target |
|---|---|---|
| Table cells, born-digital PDFs | 97.7% | 90% |
| Table cells, Word, PowerPoint, Excel | 100% | 98% |
| Table cells, scanned PDFs | 79.6% exact (82.7% ignoring spacing) | 80% |
| Body text words, born-digital | 98.0% | 97% |
| Body text words, scanned | 91.4% | 90% |

Scanned tables are the hard case: OCR sometimes misreads a decimal point or a "±" sign. For scanned financial tables, check key figures against the page.

### Limits

- Files up to 100 MB by link, 10 MB each as base64 (5 per run). Up to 200 links per run.
- Up to 2,000 pages per document (default 200).
- Time limits: 60 seconds to download, 2 minutes per page, 10 minutes per document. A stuck page is skipped. Pages that cannot finish within the document limit are listed in `pagesSkipped` and not charged (status `PARTIAL`); ask for them with `pages` in another run. A document that hangs completely is an error and free.
- Speed at the default 4 GB: about 2 to 3 seconds per text page, about 15 seconds per scanned page, and up to 30 seconds per page of dense tables, plus about 30 seconds to load the models once per run. More memory gives the run more CPU and makes it faster.
- OCR languages: English, Spanish, French, German, Portuguese, Italian.
- Password-protected PDFs and old binary Office formats (.doc, .xls, .ppt) are refused with a clear message (free).
- Only public web addresses: links to localhost, private networks or internal hosts are refused.

### Privacy

Files are downloaded into the run, converted there and deleted when the run ends. Results are kept only in your own Apify run storage (dataset and key-value store), under your account's retention settings. Logs hold only the link, status and counts, never document content.

### FAQ

#### Does it read scanned PDFs?

Yes. With `ocr: "auto"` (the default) any page without a text layer is read with Tesseract OCR and billed as a scanned page ($0.01). Pages that already have text are read directly and billed as normal pages.

#### Can I get only the tables?

Set `tablesAs: "json"` and `inlineMarkdownMaxChars: 0`. Each row then holds the tables as headers and rows, and the full Markdown stays available at `markdownUrl`.

#### How do I keep output small for my context window?

Lower `inlineMarkdownMaxChars`, use `pages` to pick the pages you need, or ask for `chunks` and read them one at a time. Every row has a `tokenEstimate` so your agent can decide before reading.

#### Which languages?

Text-layer PDFs and Office files work in any language. OCR for scanned pages ships English, Spanish, French, German, Portuguese and Italian; pass them in `ocrLanguages`.

#### What happens at my spending limit?

Before each document the Actor works out how many pages your remaining budget covers, converts only those, lists the rest in `pagesSkipped`, sets `stoppedAtSpendingCap` in the run summary and stops. You are never charged past your maximum.

### Other Actors by Fluid Faith

- [Mobile Website Test on iPhone & Android (Mobile QA Gate)](https://apify.com/fluidfaith/mobile-qa-gate): PASS or FAIL per page on today's phones, with screenshots. $0.01 per page per phone.
- [Lighthouse & Accessibility Audit](https://apify.com/fluidfaith/lighthouse-gate): Lighthouse scores, Core Web Vitals and axe issues, median of 3 runs, PASS/FAIL and top fixes. $0.02 per URL per form factor.
- [Video Frame Extractor & Media Probe](https://apify.com/fluidfaith/media-probe): ffprobe metadata, frames, scene cuts, a contact sheet and loudness from direct video or audio links. $0.001 per frame.

Load them together as MCP tools: `https://mcp.apify.com/?tools=fluidfaith/mobile-qa-gate,fluidfaith/lighthouse-gate,fluidfaith/pdf-to-markdown-tables,fluidfaith/media-probe`

### Credits

Built on [docling](https://github.com/docling-project/docling) (MIT) with its layout model (docling-layout-heron, Apache-2.0) and TableFormer (docling-models, CDLA-Permissive-2.0), and [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) (Apache-2.0). Full list of components and licenses in LICENSES.md.

# Actor input Schema

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

Public http(s) links to .pdf, .docx, .pptx or .xlsx files, one per line (up to 200). The type is detected from the file content, not the extension. Required unless you give files. Localhost, private networks and internal hosts are refused.

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

For agents that already hold the file: a list of {"name": "report.pdf", "base64": "..."} objects. Up to 5 files, 10 MB each after decoding.

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

Page range for PDFs and PowerPoint slides, for example "1-5,8". Empty means all pages.

## `maxPagesPerDocument` (type: `integer`):

Pages beyond this limit are skipped, listed in pagesSkipped and not charged.

## `ocr` (type: `string`):

auto: read only pages with no text layer using OCR. off: never use OCR. force: OCR every page (each is billed as a scanned page).

## `ocrLanguages` (type: `array`):

Tesseract language codes used for scanned pages. Shipped: eng, spa, fra, deu, por, ita.

## `tableMode` (type: `string`):

accurate: best table structure (default). fast: quicker, slightly less precise on complex tables.

## `tablesAs` (type: `string`):

Format of each entry in the tables array: json (headers and rows), markdown, or both. Tables always also appear inline in the Markdown.

## `perPage` (type: `boolean`):

Also return pages\[] with each page's Markdown.

## `chunkTokens` (type: `integer`):

0 = off. Above 0: also return chunks\[] of about this many tokens with their page numbers, ready for RAG. 200 to 8000.

## `inlineMarkdownMaxChars` (type: `integer`):

Markdown longer than this is not put in the dataset row; read it from markdownUrl instead. Protects agent context windows.

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

How many documents are converted at the same time (1 to 4). Lowered automatically if the run memory is too small.

## Actor input object example

```json
{
  "urls": [
    "https://www.census.gov/retail/mrts/www/data/pdf/ec_current.pdf"
  ],
  "files": [],
  "pages": "",
  "maxPagesPerDocument": 200,
  "ocr": "auto",
  "ocrLanguages": [
    "eng"
  ],
  "tableMode": "accurate",
  "tablesAs": "both",
  "perPage": false,
  "chunkTokens": 0,
  "inlineMarkdownMaxChars": 200000,
  "maxConcurrency": 2
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "urls": [
        "https://www.census.gov/retail/mrts/www/data/pdf/ec_current.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fluidfaith/pdf-to-markdown-tables").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://www.census.gov/retail/mrts/www/data/pdf/ec_current.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("fluidfaith/pdf-to-markdown-tables").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://www.census.gov/retail/mrts/www/data/pdf/ec_current.pdf"
  ]
}' |
apify call fluidfaith/pdf-to-markdown-tables --silent --output-dataset

```

## MCP server setup

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

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/qoRxBpKeat9SqW32t/builds/Mkqq3iW2IviOyE3na/openapi.json
