# PDF to Text, Markdown & Tables – RAG Chunks with Page Citations (`quidnovi/pdf-text-tables-extractor`) Actor

Extract clean text, LLM-ready Markdown, tables (rows + Markdown), RAG chunks and keyword hits with page numbers from any public PDF URL. Bulk, fast, no AI cost. Failed or scanned PDFs are free.

- **URL**: https://apify.com/quidnovi/pdf-text-tables-extractor.md
- **Developed by:** [Quid Novi](https://apify.com/quidnovi) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 pdf extracted (up to 50 pages)s

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 Text, Markdown & Tables – RAG Chunks with Page Citations

Convert any **public PDF URL** into clean, structured data in one call:

- 📝 **Full text** and **per-page text**
- 🧾 **LLM-ready Markdown** with headings, tables and page markers
- 📊 **Table extraction**: every table as row arrays *and* as a Markdown table, with its page number
- 🧠 **RAG chunks** with configurable size and overlap, each tagged with `pageStart`/`pageEnd` so your AI answers can **cite the page**
- 🔎 **Find terms with page citations**: give keywords like "total due", "termination" or "allergen" and get every match with its page number and surrounding quote
- 🏷️ Document **metadata** (title, author, creator, dates), page count, word count, **SHA-256** hash and embedded links

Bulk-process hundreds of PDFs in parallel. No AI cost and no OCR fees. **Failed downloads and scanned PDFs with no text layer are not charged.**

### Use cases

- **RAG and AI agents**: feed PDFs into vector databases (Pinecone, Qdrant, Weaviate, pgvector) with page-level citations
- **Financial & legal docs**: 10-Ks, annual reports, contracts, policies, filings. Pull the text and find clauses by keyword
- **Invoices, quotes and spec sheets**: extract line-item tables to CSV/Excel
- **Research**: papers, government reports, statistics releases (BLS, Census, FDA…)
- **Restaurant & retail**: PDF menus, price lists, catalogs

### Input

```json
{
  "pdfUrls": [{ "url": "https://www.bls.gov/news.release/pdf/cpi.pdf" }],
  "pages": "1-10",
  "outputMarkdown": true,
  "extractTables": true,
  "ragChunks": true,
  "chunkSize": 1500,
  "chunkOverlap": 150,
  "searchTerms": ["total", "allergen"]
}
```

### Output (trimmed)

```json
{
  "url": "https://www.bls.gov/news.release/pdf/cpi.pdf",
  "status": "ok",
  "pageCount": 38, "pagesExtracted": 38, "wordCount": 13442, "tableCount": 1,
  "metadata": { "Title": "Consumer Price Index - August 2026", "Producer": "Adobe PDF Library 26.2.141" },
  "markdown": "<!-- page 1 -->\n...\nCONSUMER PRICE INDEX – AUGUST 2026\n...",
  "tables": [{ "page": 6, "tableIndex": 0, "rows": [["..."]], "markdown": "| ... |" }],
  "chunks": [{ "chunkIndex": 0, "pageStart": 1, "pageEnd": 1, "text": "..." }],
  "searchHits": [{ "term": "total", "page": 5, "quote": "…The all urban consumer group represents over 90 percent of the total U.S. population…" }],
  "sha256": "…",
  "charged": true
}
```

Statuses: `ok` (charged), `scanned_no_text_layer`, `fetch_error`, `access_denied`, `not_a_pdf`, `too_large`, `blocked_by_robots`, `parse_error` (all free).

### Test results (Oct 10, 2026)

| PDF | Pages | Words | Tables | Result |
|---|---|---|---|---|
| IRS Form W-9 | 6 | 6,270 | 3 | ok |
| BLS CPI news release | 38 | 13,442 | 1 | ok |
| "Attention Is All You Need" (arXiv) | 15 | 1,746\* | 6 | ok |
| SEC Form 10-K instructions | 19 | 6,491 | 0 | ok |
| FDA Food Code (668 pages, capped at 60) | 60 | 19,095 | 4 | ok |
| Restaurant PDF menu | 1 | 627 | 0 | ok |
| HTML page (not a PDF) | – | – | – | not_a_pdf (free) |
| Dead link | – | – | – | fetch_error (free) |

\*arXiv's PDF compresses spacing between words, so the word count runs low while the characters are complete.

### Pricing

A flat price per PDF covers up to 50 pages. Longer documents add a small per-page charge for each page beyond 50 (see the Pricing tab). Use `pages` or `maxPagesPerPdf` to cap cost.

### Limitations

- **No OCR**: scanned, image-only PDFs come back as `scanned_no_text_layer` and are not charged.
- Rotated margin text (for example vertical form labels) is dropped on purpose.
- Only public URLs. Login-walled or paywalled files are refused. robots.txt is respected.

# Actor input Schema

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

Public PDF links (reports, filings, invoices, spec sheets, menus, papers). Login-walled or paywalled files are not supported.

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

Optional, e.g. 1-5,8,10-12. Empty = all pages (up to the max below).

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

Max pages per PDF.

## `outputMarkdown` (type: `boolean`):

LLM-ready Markdown with headings and tables, with page markers.

## `extractTables` (type: `boolean`):

Tables as row arrays and Markdown, with page numbers.

## `perPageText` (type: `boolean`):

Per-page text.

## `ragChunks` (type: `boolean`):

Overlapping text chunks, each with pageStart/pageEnd for citations.

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

Chunk size (characters).

## `chunkOverlap` (type: `integer`):

Chunk overlap (characters).

## `searchTerms` (type: `array`):

Optional. Returns each match with page number and surrounding quote, e.g. 'total due', 'termination', 'allergen'.

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

Max concurrency.

## Actor input object example

```json
{
  "pdfUrls": [
    {
      "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
    },
    {
      "url": "https://www.bls.gov/news.release/pdf/cpi.pdf"
    }
  ],
  "maxPagesPerPdf": 200,
  "outputMarkdown": true,
  "extractTables": true,
  "perPageText": true,
  "ragChunks": true,
  "chunkSize": 1500,
  "chunkOverlap": 150,
  "maxConcurrency": 4
}
```

# Actor output Schema

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

Text, Markdown, tables, RAG chunks and keyword hits with page numbers for each PDF.

# 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://www.irs.gov/pub/irs-pdf/fw9.pdf"
        },
        {
            "url": "https://www.bls.gov/news.release/pdf/cpi.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("quidnovi/pdf-text-tables-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://www.irs.gov/pub/irs-pdf/fw9.pdf" },
        { "url": "https://www.bls.gov/news.release/pdf/cpi.pdf" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("quidnovi/pdf-text-tables-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://www.irs.gov/pub/irs-pdf/fw9.pdf"
    },
    {
      "url": "https://www.bls.gov/news.release/pdf/cpi.pdf"
    }
  ]
}' |
apify call quidnovi/pdf-text-tables-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,quidnovi/pdf-text-tables-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/ErTYWP4aMHw7oPnfr/builds/jy9aQgbKHvMt6mmaD/openapi.json
