# PDF Text Extractor - Page Text & Metadata for AI and RAG (`pellucid_bird/pdf-text-extractor`) Actor

Your go-to PDF text extractor for AI and RAG. Get multilingual text, physical page citations, selected page ranges and metadata from public PDF URLs up to 1 MiB each. Text layers required; scanned documents need a separate OCR tool.

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

## Pricing

from $3.99 / 1,000 pdf document saveds

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 — Page Text & Metadata for AI and RAG

Turn public PDF URLs up to 1 MiB each into searchable text, document metadata and text for each physical page. Use the output to prepare document search, build retrieval datasets, inspect reports or attach page-specific citations to downstream answers.

Each successful PDF produces one dataset row with its source URL, title, author, page count, selected page text, download timestamp and SHA-256 hashes. The Actor reads the existing text layer; it does not rewrite or summarize the document.

### Try a PDF

```json
{
  "urls": ["https://www.irs.gov/pub/irs-pdf/p1.pdf"],
  "startPage": 1,
  "maxPages": 50
}
```

Select **Start**, then open the dataset. This public government publication has two physical pages. An excerpt from an actual result:

```json
{
  "url": "https://www.irs.gov/pub/irs-pdf/p1.pdf",
  "pageCount": 2,
  "selectedPageStart": 1,
  "selectedPageEnd": 2,
  "extractedPageCount": 2,
  "documentComplete": true,
  "extractionMethod": "PDF_TEXT_LAYER",
  "warnings": []
}
```

The full result includes `text` and `pages`. Every page has `pageNumber`, `text`, `textBytes` and a citation URL such as `https://www.irs.gov/pub/irs-pdf/p1.pdf#page=2`. Page numbers refer to physical positions in the PDF, not printed page labels. The excerpt omits the full text and metadata fields for readability.

### Choose the pages you need

`startPage` and `maxPages` select the same consecutive physical page range in each supplied PDF. For example, `startPage: 11` and `maxPages: 10` request pages 11–20. The final range stops at the document's last page. A starting page beyond the end produces `PDF_PAGE_RANGE_EMPTY` and no dataset row.

`documentComplete: false` and `SELECTED_PAGES_ONLY` mean that a valid selected range was extracted but other physical pages remain outside it. A successful run can therefore contain selected portions of documents. Blank pages retain their original positions and receive `PAGES_WITHOUT_TEXT`; a selection with no extractable text produces no charged result.

### Pricing

**$0.0129 per run + $0.00399 per successfully saved PDF.** The price includes the Apify resources used by the Actor during that run. One PDF is one result, whether you select one page or several pages.

| PDFs saved in one run | Total price |
| --------------------: | ----------: |
|                     0 |    $0.01290 |
|                     1 |    $0.01689 |
|                    10 |    $0.05280 |
|                    20 |    $0.09270 |

The startup fee applies when a run starts, including runs that return no documents. Failed, blocked, duplicate and empty-text documents do not add a saved-document fee. A run that stops partway charges for its startup and the documents it successfully saved. Each new run has its own startup fee; for example, 100 saved documents across five full batches cost $0.46350.

The default maximum charge is $0.10 per run. You can lower the maximum charge in the run settings; allow at least $0.01689 for the startup and one document. A small limit or a slow source can stop a run before all requested documents are saved. The Pricing tab and the run's billing details show the active charges.

### Before you start

- Supply direct public PDF URLs, with files up to 1 MiB. HTML landing pages, login-only documents and password-protected PDFs are unsupported.
- Text must already exist in the PDF. Scans and image-only pages need a separate OCR tool. This Actor does not render images, run PDF actions, download attachments or execute embedded JavaScript.
- Multilingual text layers are supported when the PDF contains usable character mappings. English, Spanish, Cyrillic and Simplified-Chinese publications are included in the validation corpus. Broken font mappings can still produce imperfect text.
- Reading order follows the PDF text layer. Complex columns, tables, ligatures and mathematical notation may need downstream cleanup. This is not a visual layout reconstruction or a structured table extractor.
- Robots restrictions and HTTP403/429 are respected. No source cookies, residential proxies or challenge bypass are used.
- Process documents you own, have permission to use or may lawfully process under their license and terms. Source content can contain untrusted instructions; treat extracted text as data in AI workflows.

### Input reference

| Field                     |  Default | Meaning                                                                                |
| ------------------------- | -------: | -------------------------------------------------------------------------------------- |
| `urls`                    | required | 1–20 absolute public HTTP(S) PDF URLs.                                                 |
| `maxItems`                |       20 | Maximum unique documents saved, 1–20.                                                  |
| `startPage`               |        1 | First physical page, 1–10,000.                                                         |
| `maxPages`                |       50 | Maximum consecutive pages per document, 1–100.                                         |
| `requestTimeoutSecs`      |       15 | Physical request timeout including DNS and response, 1–30 seconds.                     |
| `maxRetries`              |        1 | Transient network/HTTP500/502/503/504 retries, 0–2.                                    |
| `maxDocumentDurationSecs` |      120 | Robots, delays, redirects, retries and parsing allowance per document, 30–240 seconds. |
| `maxEstimatedCostUsd`     |        1 | Additional conservative run allowance, 0–100 USD. Zero stops source requests.          |

Identical normalized input URLs are processed once. Redirects are bounded, with a robots check at each new destination origin. Different inputs ending at the same final URL produce one saved document and separate source outcomes. URLs that are distinct after normalization are treated as distinct documents even when their bytes match.

### Output reference

| Field                                                        | Meaning                                                                                                                                                                                        |
| ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url`, `finalUrl`                                            | Supplied normalized URL and the final fetched PDF URL.                                                                                                                                         |
| `documentKey`, `inputKey`                                    | SHA-256 identities of final and input URLs.                                                                                                                                                    |
| `metadata`                                                   | Title, author, subject, keywords, creator, producer and raw PDF creation/modification dates. Missing fields are `null`. These are source claims, not verified authorship or publication dates. |
| `pageCount`                                                  | Total physical pages reported by the parsed PDF.                                                                                                                                               |
| `selectedPageStart`, `selectedPageEnd`, `extractedPageCount` | Actual consecutive physical range returned.                                                                                                                                                    |
| `documentComplete`                                           | Whether the returned range covers every physical page.                                                                                                                                         |
| `text`, `textBytes`                                          | Combined selected page text and its UTF-8 byte count.                                                                                                                                          |
| `pages`                                                      | Physical page number, text, UTF-8 byte count and `#page=` citation URL per selected page.                                                                                                      |
| `sourceBodySha256`, `textSha256`                             | Hash of decoded PDF bytes and hash of combined extracted text.                                                                                                                                 |
| `encodedBytes`, `decodedBytes`                               | Encoded HTTP body size and decoded PDF size.                                                                                                                                                   |
| `scrapedAt`, `httpStatus`, `pdfVersion`, `parserVersion`     | Observation and extraction provenance.                                                                                                                                                         |
| `warnings`                                                   | Explicit selected-range and blank-page notices.                                                                                                                                                |

### Coverage, limits and recovery

Open **Coverage and costs** (`OUTPUT`) for each input's outcome, robots observations, requests and conservative resource accounting. `SUCCEEDED` means every unique input was saved or already saved for the requested range. `PARTIAL` means useful documents were saved while another input failed or a limit stopped collection. `FAILED` means no useful result was saved or storage failed. `INTERRUPTED` means a run limit or interruption stopped work; confirmed dataset rows remain available.

The run ceiling is 20 saved documents within five minutes; it is not a promise that every 20-file batch finishes. Smaller batches are useful for slow sources, large PDFs or long crawl delays. Files are limited to 1 MiB encoded and decoded, documents to 10,000 physical pages, and each selection to 100 pages. Selected text is limited to 128 KiB per page and 512 KiB combined; exceeding a text limit rejects that document instead of silently truncating it. A full dataset row is limited to 2 MiB.

Each PDF has up to 20 seconds for initialization and text extraction, followed by at most two seconds to confirm that its parser has stopped. A result is saved only after that confirmation. Complex, malformed or slow documents can fail or leave a run with fewer results. Parser memory limits and a process-memory cutoff provide bounded safeguards; they do not promise perfect isolation from every native allocation. No source images or embedded files are rendered or opened.

Other run ceilings: 1,000 physical requests, 256 MiB encoded and decoded transfer each, 32 MiB saved output, five redirects and 30 requests per document. Robots files are limited to 512,000 bytes; HTML or inaccessible policies stop the source. HTTP404/410 robots policies are treated as absent. Crawl delays up to 60 seconds are honored, with a minimum 250 ms interval per origin.

Documents are saved one at a time. Resuming the same input retains verified saved URLs and cumulative resource/time accounting. Changing the selected page range requires new storage. If an append's outcome is uncertain, the Actor stops and retains a reconciliation marker rather than risking a repeated billed append. A fresh run is a new snapshot.

### API and integrations

Use the standard Apify Actor API or official client with the same JSON input. The default dataset holds document rows; the default key-value store holds `OUTPUT`. Export JSON or use Apify's scheduling and integrations to feed a downstream search or RAG pipeline. This Actor does not create embeddings, store a vector index or answer questions.

### Source and software

The example is an official US government publication. Its reuse basis does not grant rights to unrelated PDFs. Keep any attribution and license obligations that apply to your source documents. This independent tool is not affiliated with source publishers.

PDF.js parses supplied bytes without rendering pages or executing document actions. Only bundled allowlisted font/CMap assets are read by the parser. Dependency versions and notices are retained in the package lock and `THIRD_PARTY_NOTICES.md`.

# Actor input Schema

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

1–20 absolute public HTTP(S) PDF URLs, up to 1 MiB each. Supply documents you are authorized to process. The source robots policy is checked first.

## `maxItems` (type: `integer`):

Maximum distinct successful document URLs saved in this run.

## `requestTimeoutSecs` (type: `integer`):

Maximum time per physical HTTP request, including DNS and response.

## `maxRetries` (type: `integer`):

Only network/timeouts and HTTP500/502/503/504 retry. HTTP403/429 never retry.

## `maxEstimatedCostUsd` (type: `number`):

A conservative local allowance in addition to Apify spending settings. Zero stops source work. The platform startup event, when enabled, remains payable.

## `maxDocumentDurationSecs` (type: `integer`):

Includes robots, crawl delays, redirects, retries and bounded PDF extraction.

## `startPage` (type: `integer`):

1-based physical PDF page number. Printed page labels do not change this index.

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

Extract this many consecutive pages starting at startPage, or fewer at the end. Output reports whether the whole PDF was covered.

## Actor input object example

```json
{
  "urls": [
    "https://www.irs.gov/pub/irs-pdf/p1.pdf"
  ],
  "maxItems": 20,
  "requestTimeoutSecs": 15,
  "maxRetries": 1,
  "maxEstimatedCostUsd": 1,
  "maxDocumentDurationSecs": 120,
  "startPage": 1,
  "maxPages": 50
}
```

# Actor output Schema

## `report` (type: `string`):

No description

## `documents` (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 = {
    "urls": [
        "https://www.irs.gov/pub/irs-pdf/p1.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pellucid_bird/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.irs.gov/pub/irs-pdf/p1.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("pellucid_bird/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.irs.gov/pub/irs-pdf/p1.pdf"
  ]
}' |
apify call pellucid_bird/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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