# PDF Text Extractor: Text, Markdown & RAG Chunks (`digitalni.produkty.pro.zivot/pdf-text-extractor`) Actor

Extract clean text, Markdown with headings, per-page text, metadata and RAG-ready chunks from PDF URLs, or give a web page and every linked PDF is found and extracted. Pay only for successfully extracted PDFs.

- **URL**: https://apify.com/digitalni.produkty.pro.zivot/pdf-text-extractor.md
- **Developed by:** [Digitální produkty pro život](https://apify.com/digitalni.produkty.pro.zivot) (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 $3.00 / 1,000 pdf extracteds

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 any PDF into clean, structured text. Paste links to PDF files, **or just paste a web page** (a reports, downloads or documents page) and every PDF linked from it is found and extracted for you.

You get plain text, **Markdown with headings and bullet lists**, document metadata, optional **text per page** and optional **RAG-ready chunks** for embeddings and vector databases.

### What you get for each PDF

| Field | Example |
|---|---|
| `url`, `fileName`, `sourcePage` | where the PDF came from |
| `title`, `author`, `subject`, `keywords` | from PDF metadata (title falls back to the biggest heading) |
| `createdAt`, `modifiedAt` | ISO dates |
| `pageCount`, `pagesExtracted`, `wordCount`, `charCount` | size of the document |
| `text` | clean text with paragraphs |
| `markdown` | headings (`#`, `##`, `###`) detected from font sizes, bullet lists, joined hyphenated words |
| `pages` | `[{ page, text }]` when *Text per page* is on, great for citations |
| `chunks` | text split on paragraph and sentence boundaries when *RAG chunk size* is set |

A run summary with every skipped file and the reason is saved to the `SUMMARY` record.

### Use cases

- **LLM and RAG pipelines**: feed reports, manuals and papers into ChatGPT, Claude or a vector database as Markdown or ready-made chunks.
- **Monitor document pages**: extract all annual reports, tenders, price lists or policies linked from a company page, and schedule the run.
- **Research**: bulk-extract scientific papers (arXiv and others) with titles and page counts.
- **Search and archiving**: make PDF libraries full-text searchable.

### How to use

1. Add PDF links or web page links to **PDF or page URLs**.
2. Optional: turn on **Text per page**, set **RAG chunk size** (e.g. `1000`) or limit **Max pages per PDF**.
3. Run and download the results as JSON, CSV, Excel or via API.

#### Example input

```json
{
  "urls": ["https://arxiv.org/pdf/1706.03762", "https://www.irs.gov/forms-pubs/about-form-w-9"],
  "chunkSize": 1000,
  "includePages": true
}
```

#### Example output (shortened)

```json
{
  "url": "https://arxiv.org/pdf/1706.03762",
  "title": "Attention Is All You Need",
  "pageCount": 15,
  "wordCount": 6225,
  "createdAt": "2024-04-10T21:11:43.000Z",
  "markdown": "# Attention Is All You Need\n\nAshish Vaswani ...\n\n### Abstract\n\nThe dominant sequence transduction models ...",
  "chunks": ["Attention Is All You Need ...", "..."]
}
```

### Pricing

You pay only for **successfully extracted PDFs**, no matter how many pages they have. Failed downloads, broken files, password-protected files without a password and scanned PDFs without a text layer are **never charged**. See the Pricing tab for the current price.

### Limits and notes

- Scanned PDFs (images only, no text layer) are skipped, because OCR is not included.
- Password-protected PDFs work when you enter the password.
- Files above *Max file size* (default 50 MB) are skipped.
- Multi-column layouts follow the reading order stored in the PDF, which is correct for most documents.
- Only process documents you are allowed to access and use.

### Questions or ideas?

Open an issue on the **Issues** tab. Feature requests are welcome and usually answered within a day or two.

### How to use it via API

You can run the Actor from the Apify Console, on a schedule, or from your own code. Get your API token in Apify Console → Settings → Integrations.

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("digitalni.produkty.pro.zivot/pdf-text-extractor").call(run_input={
    "urls": [
        "https://arxiv.org/pdf/1706.03762"
    ],
    "includeMarkdown": True,
    "chunkSize": 1000
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**JavaScript / Node.js**

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('digitalni.produkty.pro.zivot/pdf-text-extractor').call({
    "urls": [
        "https://arxiv.org/pdf/1706.03762"
    ],
    "includeMarkdown": true,
    "chunkSize": 1000
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Integrations and AI agents

- Export results as **JSON, CSV, Excel, XML or HTML**, or open them directly in **Google Sheets**.
- Connect to **Make, Zapier, n8n, Slack, Google Drive, Airbyte** or any **webhook** to get text, Markdown and RAG chunks from PDFs into your workflow automatically.
- Use it from **AI agents and LLM apps** (Claude, ChatGPT, Cursor, LangChain…) through the **Apify MCP server**: the agent can call this Actor as a tool.
- **Schedule** runs (hourly, daily, weekly) to keep data fresh without any code.

### FAQ

**How much does it cost?**
$0.003 per successfully extracted PDF, regardless of page count. 1,000 PDFs cost $3. Failed, scanned and skipped files are free.

**Does it do OCR on scanned PDFs?**
No. It extracts the text layer, which is fast and cheap. Image-only scans are detected, reported and not charged.

**Can I use it for RAG / LLM pipelines?**
Yes. Set a RAG chunk size (and overlap) and load the dataset straight into LangChain, LlamaIndex or a vector database through the Apify API.

**Can it find PDFs on a web page?**
Yes. Give a page URL and every linked PDF is discovered and extracted.

# Actor input Schema

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

Links to PDF files, one per line. You can also enter a web page (e.g. a reports or downloads page): every PDF linked from it is found and extracted.

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

If a URL is a web page instead of a PDF, extract the PDFs it links to.

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

Limit for PDFs taken from one web page.

## `maxPdfs` (type: `integer`):

Safety limit for the total number of PDFs processed in one run.

## `includeMarkdown` (type: `boolean`):

Add a Markdown version with headings detected from font sizes and bullet lists. Great for LLMs.

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

Add a list with the text of every page separately (for page citations).

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

Split the text into chunks of about this many characters on paragraph and sentence boundaries, ready for embeddings and vector databases. 0 = no chunks.

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

How many characters neighbouring chunks share.

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

Only extract the first N pages of each PDF. 0 = all pages.

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

Larger PDFs are skipped (not charged).

## `password` (type: `string`):

Password for protected PDFs (used for all files in the run).

## `concurrency` (type: `integer`):

How many PDFs are processed at the same time.

## Actor input object example

```json
{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://arxiv.org/pdf/1706.03762"
  ],
  "findPdfsOnPages": true,
  "maxPdfsPerPage": 20,
  "maxPdfs": 100,
  "includeMarkdown": true,
  "includePages": false,
  "chunkSize": 0,
  "chunkOverlap": 100,
  "maxPagesPerPdf": 0,
  "maxFileSizeMb": 50,
  "concurrency": 3
}
```

# Actor output Schema

## `pdfs` (type: `string`):

Text, Markdown, metadata, page and word counts for each PDF.

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

Counts of extracted and skipped PDFs with the reason for every skipped file.

# 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",
        "https://arxiv.org/pdf/1706.03762"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("digitalni.produkty.pro.zivot/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",
        "https://arxiv.org/pdf/1706.03762",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("digitalni.produkty.pro.zivot/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",
    "https://arxiv.org/pdf/1706.03762"
  ]
}' |
apify call digitalni.produkty.pro.zivot/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,digitalni.produkty.pro.zivot/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/PGXhhE4DKWpaJauvI/builds/FCmqTu9MPad1bXbXt/openapi.json
