# PDF Text Extractor: Text, Markdown & RAG Chunks (`promur/pdf-text-extractor`) Actor

Extract text from PDF files or from every PDF linked on a web page: clean text with paragraphs, Markdown headings, metadata, links, page-by-page or as RAG-ready chunks with page numbers. Pay only for PDFs with text. No browser.

- **URL**: https://apify.com/promur/pdf-text-extractor.md
- **Developed by:** [PROMUR s.r.o.](https://apify.com/promur) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 pdf reads

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 Text Extractor: Text, Markdown & RAG Chunks

Turn **PDF files into clean text** - with **paragraphs, Markdown headings, metadata and links** - one row per PDF, **per page**, or as **RAG-ready chunks with page numbers** for your vector database or AI agent. Paste PDF links, or a **web page**, and every PDF linked on it is read.

Runs on pdf.js (Mozilla's PDF engine): no browser, no proxy, no API key.

### Why this Actor

**Price, quality, reliability, responsibility - in balance:**

- 💵 **Low price** - $2 per 1,000 PDFs, whatever the page count or output mode; scanned or blocked files are free.
- 🔍 **Readable text** - paragraphs, Markdown headings, metadata, links and RAG-ready chunks with page numbers.
- 🔁 **Dependable runs** - a status and reason for every file, a clean stop at your budget.
- 🤝 **Responsible collection** - robots.txt is checked before every download; bot checks are never worked around.

**What you get:**

- 🧠 **Ready for AI** - *chunks* mode splits the text at sentence boundaries into chunks of your size with overlap, each with `pageFrom` / `pageTo`, ready for embeddings and RAG.
- 📝 **Readable text** - line and paragraph breaks are rebuilt from the layout; optional **Markdown** turns large-font lines into `#` / `##` headings.
- 🔗 **Whole document libraries** - paste a web page (a reports page, a document archive) and the Actor reads every PDF it links to, robots.txt respected.
- 🧾 **Metadata and links** - title, author, subject, keywords, creator, producer, creation and modification dates, PDF version, page count, word count, and every link in the PDF.
- 💸 **Pay only for PDFs with text** - scanned PDFs without a text layer, files over your size limit, missing or blocked files are listed with their reason and **not charged**. One price per PDF, however many pages or chunks.

### Use cases

- **RAG and AI assistants** - feed reports, manuals, papers and contracts into a vector database.
- **Document research** - search and analyse annual reports, tenders, regulations, product sheets.
- **Archive processing** - extract text from every PDF on a document page in one run.
- **Data pipelines** - PDF text into Google Sheets, Airtable, Make, Zapier or your database.

### How to use

1. Paste PDF links (or web pages that link to PDFs) under **PDF links or web pages**.
2. Choose **Output**: one row per PDF, per page, or per chunk. Optional: **Markdown**, chunk size and overlap, page and file-size limits.
3. Click **Start**. Download the results as JSON, CSV or Excel, or connect them to your tools.

```json
{
    "urls": ["https://example.com/annual-report-2025.pdf", "https://example.com/investors/reports"],
    "outputMode": "chunks",
    "chunkSize": 1500,
    "chunkOverlap": 150,
    "markdown": true
}
```

### Output

**One row per PDF** (`document`): `url`, `finalUrl`, `fileName`, `status`, `message`, `pageCount`, `pagesRead`, `title`, `author`, `subject`, `keywords`, `creator`, `producer`, `createdAt`, `modifiedAt`, `language`, `pdfVersion`, `isEncrypted`, `hasForm`, `fileSizeBytes`, `wordCount`, `charCount`, `text`, `markdown` (option), `pages` (option), `links`, `sourcePage`, `scrapedAt`.

**One row per page** (`pages`): `url`, `fileName`, `title`, `page`, `pageCount`, `text`, `markdown` (option), `wordCount`, `sourcePage`.

**One row per chunk** (`chunks`): `url`, `fileName`, `title`, `chunk`, `chunkCount`, `pageFrom`, `pageTo`, `text`, `wordCount`, `sourcePage`.

```json
{
    "fileName": "annual-report-2025.pdf",
    "title": "Annual Report 2025",
    "chunk": 3,
    "chunkCount": 41,
    "pageFrom": 4,
    "pageTo": 5,
    "text": "Revenue grew 12% year over year. ...",
    "wordCount": 236
}
```

| `status` | Meaning (all but `ok` are free) |
| --- | --- |
| `ok` | text extracted |
| `no_text` | the PDF is scanned images only; OCR is not included |
| `too_large` | larger than *Max file size* |
| `password` / `invalid_pdf` | password-protected or damaged file |
| `not_pdf` / `no_pdfs` | a web page (with *Read PDFs linked on web pages* off) / a web page without PDF links |
| `robots_disallowed` | the site's robots.txt does not allow automated reading of that page or file |
| `blocked`, `not_found`, `error`, `duplicate`, `skipped` | the site refused access / missing / other error / same file twice / budget or time limit reached |

`sourcePage` is the web page a PDF was found on. **Run summary:** a `SUMMARY` record (Storage → Key-value store) with PDFs read and counts per status.

### Pricing

**$2.00 per 1,000 PDFs read** - one price per PDF with text, whatever the output mode, page count or number of chunks.

- 500 reports: **$1.00**.

Set *Maximum cost per run* in the run options: the Actor stops cleanly at that amount.

### FAQ

**Does it do OCR on scanned PDFs?** No. Scanned PDFs without a text layer are reported as `no_text` and not charged.

**Tables?** Table text comes out line by line in reading order; cell structure is not rebuilt.

**Password-protected PDFs?** Not supported (`password`).

**Does it follow links on the web page beyond the PDFs?** No - one level: the page you give and the PDF files it links to.

### Support

A PDF that comes out wrong? Open an issue on the **Issues** tab with the link and the run link - we usually fix it fast.

# Actor input Schema

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

One per line:<br>• a <b>PDF link</b> - the file is downloaded and read<br>• a <b>web page</b> - every PDF linked on that page is read (see <i>Read PDFs linked on web pages</i>), as long as the site's robots.txt allows it

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

How the text is split into dataset rows. The price is per PDF in every mode.

## `markdown` (type: `boolean`):

Also return the text as Markdown: lines in a clearly larger font become # and ## headings.

## `includePages` (type: `boolean`):

Adds a <code>pages</code> array (page number + text) next to the full text.

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

Chunks mode: maximum characters per chunk. Chunks end at sentence boundaries.

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

Chunks mode: each chunk starts with up to this many characters of the previous one (whole sentences).

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

Read only the first N pages of each PDF. 0 = all pages.

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

Larger files are skipped (status <code>too_large</code>, not charged).

## `findPdfsOnPages` (type: `boolean`):

When a line is a web page, read the PDF files it links to (one level, robots.txt respected). Off: web pages are reported as <code>not_pdf</code>.

## `maxPdfsPerPage` (type: `integer`):

How many linked PDFs are read from one web page (in page order).

## Actor input object example

```json
{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "outputMode": "document",
  "markdown": false,
  "includePages": false,
  "chunkSize": 2000,
  "chunkOverlap": 200,
  "maxPagesPerPdf": 0,
  "maxFileSizeMb": 50,
  "findPdfsOnPages": true,
  "maxPdfsPerPage": 50
}
```

# Actor output Schema

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

One row per PDF (url, fileName, pageCount, title, author, subject, keywords, creator, producer, createdAt, modifiedAt, language, wordCount, charCount, text, markdown, pages, links, sourcePage, status), per page (page, text) or per chunk (chunk, chunkCount, pageFrom, pageTo, text), depending on the Output setting. PDFs that could not be read have a row with status and message.

## `summary` (type: `string`):

Links given, PDFs read (charged), and counts per status (ok, no_text, too_large, password, invalid_pdf, not_pdf, no_pdfs, robots_disallowed, blocked, not_found, error, duplicate, skipped).

# 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.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("promur/pdf-text-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 = { "urls": ["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("promur/pdf-text-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 '{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ]
}' |
apify call promur/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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