# PDF Text Extractor (PDF to Text from URL) (`plainrecords/pdf-text-extractor`) Actor

Extract the text of PDF files from URLs, page by page, with title and dates. Built for AI agents, RAG pipelines and data entry. Scanned PDFs are flagged.

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

## Pricing

from $2.40 / 1,000 pdfs

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 (PDF to Text from URL)

Turn PDF links into clean text. Give the Actor one or more public PDF URLs and get the full text, the text of each page, the page count and the document's title and dates. Built for AI agents, RAG pipelines, document search and data entry.

The PDFs are processed inside the Actor with pdf.js. No third-party API, no OCR fees, predictable cost per file.

### What you get

One row per PDF. Every row has `query`, `status` (`ok`, `not_found` or `error`), `source` and `retrievedAt`, plus:

| Field | Example | Meaning |
|---|---|---|
| `fileName` | `annual-report-2025.pdf` | From the server or the URL |
| `sizeBytes` | `482113` | File size |
| `pageCount` / `pagesExtracted` | `48` / `48` | Pages in the file and pages read |
| `truncated` | `false` | True if **Max pages** cut the document short |
| `title` / `subject` / `keywords` | `Annual Report 2025` | From the PDF metadata |
| `createdAt` / `modifiedAt` | `2026-03-02T10:15:00.000Z` | From the PDF metadata |
| `hasTextLayer` | `true` | False when the PDF is scanned images |
| `charCount` / `wordCount` | `153204` / `24877` | Size of the extracted text |
| `text` | `Annual Report 2025 ...` | Full text, pages separated by a blank line |
| `pages` | `[{ "page": 1, "text": "...", "chars": 1840 }]` | Text per page (can be switched off) |

The author field of the PDF metadata is not returned.

### Use cases

- **AI agents and chatbots:** let an agent read a PDF it found and answer questions about it.
- **RAG and search:** feed page-level text into a vector store with page numbers for citations.
- **Data entry:** pull text from invoices, price lists, tenders, filings or reports for parsing.
- **Monitoring:** extract the text of the same PDFs on a schedule and compare versions.

### How to use

1. Paste PDF URLs into **PDF URLs**, one per line. The link must lead to the file itself.
2. Optional: choose **Pages** (for example `1-3, 10-`), **Max pages per PDF**, and whether to include text per page.
3. Set **Max results** to cap the cost, then click **Start**. Export as JSON, CSV or Excel, or read the dataset through the API.

#### Input example

```json
{
    "queries": ["https://www.rfc-editor.org/rfc/rfc9100.pdf"],
    "includePages": true,
    "maxResults": 10
}
```

#### Output example

```json
{
    "query": "https://www.rfc-editor.org/rfc/rfc9100.pdf",
    "status": "ok",
    "url": "https://www.rfc-editor.org/rfc/rfc9100.pdf",
    "finalUrl": "https://www.rfc-editor.org/rfc/rfc9100.pdf",
    "fileName": "rfc9100.pdf",
    "sizeBytes": 134620,
    "pageCount": 7,
    "pagesExtracted": 7,
    "truncated": false,
    "title": "RFC 9100: Sensor Measurement Lists (SenML) Features and Versions",
    "subject": "This short document updates RFC 8428, ...",
    "keywords": null,
    "creatorTool": "xml2rfc 3.9.1",
    "producer": "cairo 1.16.0",
    "createdAt": "2021-08-16T07:53:34.000Z",
    "modifiedAt": "2021-08-16T21:53:35.000Z",
    "pdfVersion": "1.5",
    "hasTextLayer": true,
    "charCount": 13626,
    "wordCount": 2131,
    "text": "RFC 9100\nSensor Measurement Lists (SenML) Features and\nVersions\nAbstract\n...",
    "pages": [
        { "page": 1, "text": "RFC 9100\nSensor Measurement Lists (SenML) Features and\nVersions\nAbstract\n...", "chars": 1674 },
        { "page": 2, "text": "Table of Contents\n1. Introduction\n1.1. Terminology\n...", "chars": 1478 }
    ],
    "retrievedAt": "2026-11-15T00:43:18.415Z",
    "source": "PDF URL (text layer extracted with pdf.js)"
}
```

### Pricing

You pay per PDF whose text was extracted (status `ok`). Broken links, non-PDF pages, password-protected files and files above the size limit are free. The price per 1,000 PDFs is on the **Pricing** tab and is lower on higher Apify plans.

### Use from AI agents and the API

This Actor runs with limited permissions, so AI agents and MCP clients can call it directly through the Apify API or the Apify MCP server. For long documents, set **Include text per page** to false and use `text`, or keep the pages to cite page numbers.

### Data source and limits

- Works on PDFs with a text layer (most PDFs made by software). Scanned PDFs return `hasTextLayer: false` and little or no text; there is no OCR.
- Only public URLs. Files behind a login or a paywall are not supported.
- Default limits: 50 MB per file and 500 pages per file. Both can be changed in the input.
- Tables come out as text lines, not as structured cells.

### Support

Open an issue on the **Issues** tab. We answer within 24 hours and post what went wrong and when it is fixed.

# Actor input Schema

## `queries` (type: `array`):

One public PDF URL per line. The link must lead straight to the file (it may redirect). Pages behind a login are not supported.

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

Optional. Which pages to extract, for example 1-3, 5, 10-. Empty means all pages.

## `maxPages` (type: `integer`):

Stops long documents at this many pages. The row then has truncated = true.

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

Adds a pages array with the text of each page. Turn off for smaller output when you only need the full text.

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

Larger files are skipped with a free not_found row.

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

Stop after this many PDFs in total. Keeps the cost predictable.

## Actor input object example

```json
{
  "queries": [
    "https://www.rfc-editor.org/rfc/rfc9225.pdf"
  ],
  "maxPages": 500,
  "includePages": true,
  "maxFileSizeMb": 50,
  "maxResults": 20
}
```

# Actor output Schema

## `overview` (type: `string`):

All result rows in the overview table view.

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

Every field of every row, for the API and AI agents.

# 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 = {
    "queries": [
        "https://www.rfc-editor.org/rfc/rfc9225.pdf"
    ],
    "maxResults": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("plainrecords/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 = {
    "queries": ["https://www.rfc-editor.org/rfc/rfc9225.pdf"],
    "maxResults": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("plainrecords/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 '{
  "queries": [
    "https://www.rfc-editor.org/rfc/rfc9225.pdf"
  ],
  "maxResults": 20
}' |
apify call plainrecords/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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