# PDF to Markdown & RAG Chunks with Page Citations (`nexo_data/pdf-citable-pages-and-rag-chunks`) Actor

Convert PDF URLs into page-by-page Markdown and overlapping RAG chunks. Every chunk keeps its page number, character range and document hash for citations. Scanned pages are flagged for OCR. $0.30 per 1,000 pages.

- **URL**: https://apify.com/nexo_data/pdf-citable-pages-and-rag-chunks.md
- **Developed by:** [Nexo Data](https://apify.com/nexo_data) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.30 / 1,000 delivered text-bearing 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 & RAG Chunks with Page Citations

Convert PDF URLs into page-by-page Markdown and overlapping RAG chunks. Every chunk keeps its page number, character range and document hash for citations. Scanned pages are flagged for OCR. $0.30 per 1,000 pages.

**Store page:** https://apify.com/nexo_data/pdf-citable-pages-and-rag-chunks

### What can you do with this PDF documents scraper?

- Prepare PDFs for vector databases and RAG
- Get chunks with page numbers for citable AI answers
- Convert reports, papers and manuals to Markdown
- Bulk process PDF URLs without running your own parser

### How to convert PDFs to Markdown and RAG chunks with page citations

1. Open the Actor on Apify Store and click **Try for free**.
2. Paste your input (see the example below) in the Input tab.
3. Click **Start** and wait for the run to finish.
4. Download results as JSON, CSV, Excel or HTML, or fetch them via the Apify API.

### How to convert PDFs to Markdown and RAG chunks with page citations via API

```bash
curl -X POST "https://api.apify.com/v2/acts/nexo_data~pdf-citable-pages-and-rag-chunks/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"pdfUrls": ["https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"], "maxPagesPerPdf": 10}'
```

You can also call it from Python/JS with the `apify-client`, schedule it, or connect it to Make, Zapier, n8n or an MCP-enabled AI agent.

### How to schedule it for monitoring

Create an Apify **Schedule** (e.g. daily) with the same input. Combine with webhooks or integrations to get alerts in Slack, email or Google Sheets.

### Input example

```json
{
  "pdfUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "maxPagesPerPdf": 10
}
```

### Output example

Each item in the dataset is one result. Typical fields are listed in the **Output** tab; export to JSON/CSV/Excel.

### Pricing (pay per event)

You only pay for what you get — no monthly rental. Apify platform usage is included in the event prices below.

| Event | What it is | Price |
|---|---|---|
| `run-start` | Run initialization (including invalid inputs) — One initialization event per run, including runtime input-validation failures. | $0.003 ($3.0 / 1,000) |
| `source-check` | Bounded public-source check — One bounded public-source request attempt; charged also when access fails or filters match nothing. | $0.005 ($5.0 / 1,000) |
| `result` | Delivered text-bearing page — One delivered usable text-bearing page. Error rows do not trigger this event. | $0.001 ($1.0 / 1,000) |

Tip: set **Maximum cost per run** in run options to cap spend. New Apify accounts get free monthly credits, so your first runs are effectively free.

### FAQ

**Is it legal to scrape PDF documents?** This Actor collects only publicly available data. Make sure your use complies with the site's terms and data protection laws (e.g. GDPR).

**Do I need an API key or login?** No. Only an Apify account.

**What if a source fails?** Failed or empty sources are reported in the output for diagnosis; you are not charged the `result` event for them.

**Can I use it with AI agents / LLMs?** Yes — output is structured JSON, ready for RAG, LangChain, LlamaIndex or the Apify MCP server.

**Found a bug or need a feature?** Open an issue in the **Issues** tab — we usually respond within 24 hours.

# Actor input Schema

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

Up to 10 PDFs, maximum 15 MiB each. Embedded text only; scanned pages need an OCR service.

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

Maximum pages per PDF. See the README for coverage and billing details.

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

Chunk length in characters. See the README for coverage and billing details.

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

Overlap between chunks. See the README for coverage and billing details.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "maxPagesPerPdf": 100,
  "chunkSize": 3000,
  "chunkOverlap": 150
}
```

# 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 = {
    "pdfUrls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nexo_data/pdf-citable-pages-and-rag-chunks").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://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("nexo_data/pdf-citable-pages-and-rag-chunks").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://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ]
}' |
apify call nexo_data/pdf-citable-pages-and-rag-chunks --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nexo_data/pdf-citable-pages-and-rag-chunks"
        }
    }
}
```

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/h6gg3v2d5b90D8NK0/builds/1aGbZus2jwNDNmKTe/openapi.json
