# PDF to Text API for LLM & RAG – page by page – $1.50/1k (`henrycrawl/pdf-to-text`) Actor

Extract the text of public PDFs by URL for LLMs and RAG: full text plus text per page, title, author, dates, page and word counts. Text PDFs (no OCR). Fast HTTP, no browser. Works with AI agents via Apify MCP. $1.50 per 1,000 PDFs, no start fee; failed files are free.

- **URL**: https://apify.com/henrycrawl/pdf-to-text.md
- **Developed by:** [Henry Crawl](https://apify.com/henrycrawl) (community)
- **Categories:** AI, Developer tools, MCP servers
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 1,000 extracted pdf

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/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 API for LLM & RAG

Give it PDF links and get the text of every PDF back as JSON. You get the full text, the text of each page (so an LLM can cite page numbers), and the title, author, creation date, page count and word count. Built for AI agents, RAG pipelines and anyone who needs the words inside PDFs without running a parser.

- **$1.50 per 1,000 PDFs**, any number of pages, and **no start fee**.
- **Error rows are free.** You pay nothing for broken links, non-PDF pages, files that are too large, password-protected PDFs, or scanned PDFs with no text layer.
- Fast plain HTTP with no browser. In our test on 1 Dec 2026, 51 PDFs (1-100 pages each, median 7) took 90-129 s in two runs at the default 2 GB memory (217 s at 1 GB); download speed of the hosts varies.

### What you get per PDF

| Field | Meaning |
|---|---|
| `url`, `finalUrl` | The link you gave and the address after redirects |
| `text` | Full text of the PDF (pages separated by a blank line), cut at 2.5 MB of UTF-8 text (about 2.5 million English characters) |
| `pages[]` | `page`, `wordCount` and `text` for each page, up to 2.5 MB of text in total (turn off with `includePages: false`) |
| `title`, `author`, `subject`, `creator`, `producer` | Document metadata when the file has it (often empty in LaTeX papers) |
| `createdAt`, `modifiedAt` | Dates from the PDF metadata (converted to UTC when the PDF states a time zone) |
| `pageCount`, `pagesExtracted`, `emptyPages`, `wordCount`, `charCount` | Size of the document and how much text was found (word and character counts cover all extracted pages, even when `text` is cut) |
| `encrypted`, `truncated` | `truncated` is true when `maxPagesPerPdf` or the size limit cut the text |
| `fileSizeBytes` | Size of the downloaded file |
| `type`, `status`, `error` | `result`/`OK` for extracted PDFs; `error` rows carry a code (see below) |

**Error codes (free):** `BAD_URL`, `DOWNLOAD_FAILED` (with the HTTP status), `TIMEOUT`, `NOT_PDF`, `TOO_LARGE`, `ENCRYPTED`, `PARSE_ERROR`, `OUTPUT_TOO_LARGE`, `INTERNAL_ERROR`, `NO_INPUT`, and `NO_TEXT` (a scanned or image-only PDF; **OCR is not included**). Hosts that answer 429/5xx or time out are retried once.

### Real output (IRS Form W-9, shortened)

```json
{
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "finalUrl": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "fileSizeBytes": 140815,
  "title": "Form W-9 (Rev. March 2024)",
  "author": "SE:W:CAR:MP",
  "subject": "Request for Taxpayer Identification Number and Certification",
  "creator": "Designer 6.5",
  "producer": "Designer 6.5",
  "createdAt": "2024-03-06T08:18:13",
  "modifiedAt": "2024-03-06T08:18:13",
  "pageCount": 6,
  "pagesExtracted": 6,
  "emptyPages": 0,
  "wordCount": 6279,
  "charCount": 37694,
  "encrypted": false,
  "truncated": false,
  "text": "Form W-9\n(Rev. March 2024)\nRequest for Taxpayer\nIdentification Number and Certification\nDepartment of the Treasury\nInternal Revenue Service Go to www.irs.gov/FormW9 for instructions and the latest information.\nGive form  …",
  "pages": [
    {
      "page": 1,
      "wordCount": 933,
      "text": "Form W-9\n(Rev. March 2024)\nRequest for Taxpayer\nIdentification Number and Certification\nDepartment of the Treasury\nInter …"
    },
    {
      "page": 2,
      "wordCount": 1349,
      "text": "Form W-9 (Rev. 3-2024) Page 2\nmust obtain your correct taxpayer identification number (TIN), which\nmay be your social se …"
    }
  ],
  "type": "result",
  "status": "OK",
  "scrapedAt": "2026-12-01T01:22:59.051454+00:00"
}
```

### Input

```json
{
  "urls": [
    "https://arxiv.org/pdf/1706.03762",
    "https://arxiv.org/pdf/2005.11401",
    "https://arxiv.org/pdf/1810.04805"
  ],
  "includePages": true,
  "maxResults": 100
}
```

| Option | Default | Notes |
|---|---|---|
| `urls` | — | Direct links to PDF files. Duplicates are removed. A single link in `url` also works. If no link is given you get a free `NO_INPUT` row, except for a completely empty input, which runs the 11-PDF demo (charged as usual). |
| `includePages` | `true` | Adds the per-page list. Turn it off for a smaller output. |
| `maxPagesPerPdf` | 2000 | Reads at most this many pages (1-5000) of each file. You pay per PDF, not per page. |
| `maxFileSizeMb` | 50 | Larger files are skipped and return a free `TOO_LARGE` row (limit 1-100). |
| `maxResults` | 100 | Stops after this many successfully extracted (charged) PDFs. |

### Pricing

Pay per event: **$0.0015 per extracted PDF** ($1.50 per 1,000), with no start fee. Error rows are not charged. Your Apify spending limit for a run is respected: the actor stops before going over it.

### Use with AI agents (MCP)

Add the Apify MCP server with this actor as a tool:

`https://mcp.apify.com/?tools=henrycrawl/pdf-to-text`

Your agent can then call it with a list of PDF URLs and read the text, citing pages from `pages[].page`. It works in Claude, Cursor, ChatGPT connectors and any MCP client, and you can also call it through the Apify API from n8n, Make or Zapier.

### Limits and notes

- Only text PDFs are supported. Scanned pages return `NO_TEXT` and you are not charged.
- Layout is read as plain text: tables come out as lines of text, and multi-column pages may mix columns.
- Only publicly reachable links work. The actor does not log in or get past paywalls or bot checks.
- You are responsible for having the right to process the documents you send.

Questions or a PDF that extracts badly? Open an issue on this actor's page and we usually reply within 24 hours.

# Actor input Schema

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

Public PDF links, one per line (direct links to the file, e.g. https://arxiv.org/pdf/1706.03762). Files behind a login are not supported. Duplicates are removed.

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

Also return a `pages` list (page number, word count, text) so an LLM can cite page numbers. Turn off for a smaller output with only the full `text`.

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

Read at most this many pages of each PDF (1-5000). Longer files are marked truncated=true. Billing is per PDF, not per page.

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

Skip files larger than this (1-100 MB); skipped files return a free TOO_LARGE row.

## `maxResults` (type: `integer`):

Stop after this many PDFs have been extracted successfully (each one is one charged result). Error rows are free.

## Actor input object example

```json
{
  "urls": [
    "https://arxiv.org/pdf/1706.03762",
    "https://arxiv.org/pdf/2005.11401",
    "https://arxiv.org/pdf/1810.04805",
    "https://bitcoin.org/bitcoin.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw4.pdf",
    "https://www.irs.gov/pub/irs-pdf/f1040.pdf",
    "https://www.who.int/docs/default-source/coronaviruse/situation-reports/20200121-sitrep-1-2019-ncov.pdf",
    "https://arxiv.org/pdf/2001.08361",
    "https://www.irs.gov/pub/irs-pdf/f941.pdf",
    "https://pdfobject.com/pdf/sample.pdf"
  ],
  "includePages": true,
  "maxPagesPerPdf": 2000,
  "maxFileSizeMb": 50,
  "maxResults": 20
}
```

# Actor output Schema

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

One row per result, plus free error rows (type = error).

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

Counts for this run (SUMMARY record).

# 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://arxiv.org/pdf/1706.03762",
        "https://arxiv.org/pdf/2005.11401",
        "https://arxiv.org/pdf/1810.04805",
        "https://bitcoin.org/bitcoin.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw4.pdf",
        "https://www.irs.gov/pub/irs-pdf/f1040.pdf",
        "https://www.who.int/docs/default-source/coronaviruse/situation-reports/20200121-sitrep-1-2019-ncov.pdf",
        "https://arxiv.org/pdf/2001.08361",
        "https://www.irs.gov/pub/irs-pdf/f941.pdf",
        "https://pdfobject.com/pdf/sample.pdf"
    ],
    "maxResults": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("henrycrawl/pdf-to-text").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://arxiv.org/pdf/1706.03762",
        "https://arxiv.org/pdf/2005.11401",
        "https://arxiv.org/pdf/1810.04805",
        "https://bitcoin.org/bitcoin.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw4.pdf",
        "https://www.irs.gov/pub/irs-pdf/f1040.pdf",
        "https://www.who.int/docs/default-source/coronaviruse/situation-reports/20200121-sitrep-1-2019-ncov.pdf",
        "https://arxiv.org/pdf/2001.08361",
        "https://www.irs.gov/pub/irs-pdf/f941.pdf",
        "https://pdfobject.com/pdf/sample.pdf",
    ],
    "maxResults": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("henrycrawl/pdf-to-text").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://arxiv.org/pdf/1706.03762",
    "https://arxiv.org/pdf/2005.11401",
    "https://arxiv.org/pdf/1810.04805",
    "https://bitcoin.org/bitcoin.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw4.pdf",
    "https://www.irs.gov/pub/irs-pdf/f1040.pdf",
    "https://www.who.int/docs/default-source/coronaviruse/situation-reports/20200121-sitrep-1-2019-ncov.pdf",
    "https://arxiv.org/pdf/2001.08361",
    "https://www.irs.gov/pub/irs-pdf/f941.pdf",
    "https://pdfobject.com/pdf/sample.pdf"
  ],
  "maxResults": 20
}' |
apify call henrycrawl/pdf-to-text --silent --output-dataset

```

## MCP server setup

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

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/TXHhtoupI0svGHHb5/builds/qwqeQYOMoc6oxdqgI/openapi.json
