# PDF Text Extractor (`subimpact/pdf-text-extractor`) Actor

Extract text from PDF URLs as JSON: full text, per-page text, metadata and optional tables, one row per document. Flags scanned image-only PDFs. From $2.00 per 1,000 extracted documents, platform usage included.

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

## Pricing

from $1.50 / 1,000 document with extracted texts

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

Turn a list of PDF URLs into structured JSON: the **full document text**, **per-page text**, PDF **metadata** and, optionally, **tables** — one row per document, delivered to the run's dataset.

No browser, no API key, no login. Plain HTTP download plus a PDF parser, so a run over dozens of documents finishes in seconds.

### What you get

For each PDF URL:

- `text` — the whole document as plain text with normalised whitespace (capped at 1,000,000 characters, flagged with `truncated`).
- `pageTexts` — one text string per extracted page, so you can cite "page 4" without re-parsing.
- `tables` — optional table extraction as arrays of rows (`includeTables`).
- `title`, `author`, `subject`, `creator`, `producer`, `createdAt`, `modifiedAt` — the PDF's own metadata, dates normalised to ISO 8601 UTC.
- `pageCount` / `pagesExtracted` — real page count, and how many pages were read (capped by `maxPages`).
- `isScanned` — `true` when the document has almost no text layer (an image-only scan). Those rows are delivered but **not charged**, because v1 does not run OCR.
- `status` — `ok` (text found), `scanned`, `empty` or `error`, plus an `error` message when a download or parse failed.

### Typical uses

- Search and RAG pipelines that need clean text from reports, filings, contracts, forms and papers.
- Document intake: detect digital vs scanned PDFs before sending a file to an OCR service.
- Pull a specific table out of a recurring PDF report (invoices, statements, regulatory tables).
- Archive text alongside the source URL, page count and metadata.

### Input

```json
{
  "urls": [
    { "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf" },
    { "url": "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-145.pdf" },
    "https://arxiv.org/pdf/1706.03762"
  ],
  "maxPages": 200,
  "includeTables": false,
  "includePageTexts": true,
  "maxDocuments": 100,
  "maxFileSizeMb": 50
}
```

| Field | Default | Meaning |
|---|---|---|
| `urls` | two small public PDFs | PDF links. A plain string or `{"url": "..."}` both work; redirects are followed. |
| `maxPages` | 200 | Pages read per document. `pageCount` still reports the real total. |
| `includeTables` | `false` | Add `tables` (`[{"page": 1, "rows": [["cell", ...], ...]}]`). Slower than text-only. |
| `includePageTexts` | `true` | Add `pageTexts` (one string per extracted page). Turn off for a smaller dataset. |
| `maxDocuments` | 100 | Hard cap on delivered rows per run, including scanned/empty/error rows. Maximum 5,000. |
| `maxFileSizeMb` | 50 | Larger files are skipped as an error row; the download is aborted at the limit. |
| `proxyConfiguration` | off | Optional Apify Proxy, only needed if a publisher blocks the run's IP. |

### Output

A real row from a live run over the IRS Form W-9 (text shortened here; the dataset row carries the full 37,694 characters):

```json
{
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "finalUrl": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "fileName": "fw9.pdf",
  "sizeBytes": 140815,
  "pageCount": 6,
  "pagesExtracted": 6,
  "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-06T13:18:13Z",
  "modifiedAt": "2024-03-06T13:18:13Z",
  "text": "Form W-9\n(Rev. March 2024)\nRequest for Taxpayer\nIdentification Number and Certification\nDepartment of the Treasury\nInternal Revenue Service ...",
  "truncated": false,
  "pageTexts": [
    "Form W-9\n(Rev. March 2024)\nRequest for Taxpayer\nIdentification Number and Certification ...",
    "Form W-9 (Rev. 3-2024) Page 2\nmust obtain your correct taxpayer identification number ..."
  ],
  "tables": null,
  "isScanned": false,
  "language": "en",
  "scrapedAt": "2026-11-15T09:08:29Z",
  "status": "ok",
  "error": null
}
```

Every field is declared in the dataset schema, so the dataset table, CSV and Excel exports show all of them.

### Pricing

**$2.00 per 1,000 documents** — one charge per document delivered with extracted text (`status: ok`). Platform usage is included.

Scanned, empty and error rows are delivered with their status and are **free**: you only pay when a document actually yields text. At the default `maxDocuments: 100` a full run costs at most $0.20.

Other PDF text-extraction APIs on the Apify Store list between $3.45 and $5.00 per 1,000 documents (checked November 2026); this one is $2.00.

### Notes and limits

- **No OCR in v1.** Image-only PDFs are detected (`isScanned: true`, `status: scanned` or `empty`) and not charged. Send those to an OCR actor if you need their text.
- **Password-protected PDFs** cannot be opened and come back as `status: error` with a clear message.
- **Text quality depends on the PDF.** Documents built from text extract cleanly; unusual font encodings can lose characters. `fontTools` is installed to read CFF/Type1 fonts properly.
- **Whitespace is normalised**: runs of spaces/tabs collapse and blank lines are dropped, so layout columns are not preserved. Use `tables` for tabular data and `pageTexts` for page boundaries.
- **`text` is capped** at 1,000,000 characters; `truncated: true` and `pageTexts`/`pagesExtracted` tell you what was cut.
- Downloads are sequential and streamed, one document at a time, with a size cap — memory use stays around 100 MB in a typical text-only run.

### Run monitoring and privacy

If a run fails or times out, this Actor tells its developer the run ID and status, so we can fix problems fast. It never sends your input, your results or your account data.

# Actor input Schema

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

One entry per PDF. A plain URL string or an object with a "url" field both work. Redirects are followed and the resolved URL is reported as finalUrl.

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

Extract at most this many pages from each PDF (default 200). pageCount still reports the real page count; pagesExtracted reports how many were read, and text/pageTexts/tables cover only those pages. Lower it for very large reports to cut run time.

## `includeTables` (type: `boolean`):

Also extract tables with pdfplumber. Each table is returned as {"page": n, "rows": \[\[cell, ...], ...]}. Off by default because table detection is the slowest part of a run.

## `includePageTexts` (type: `boolean`):

Include pageTexts: one normalised text string per extracted page (empty string for image-only pages). Turn off for a smaller dataset when you only need the full text.

## `maxDocuments` (type: `integer`):

Hard cap on document rows delivered in one run, counting every delivered row (including scanned, empty and error rows). The default of 100 keeps a run well under a dollar; at $0.002 per extracted document, 100 documents cost at most $0.20 plus platform usage.

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

Skip (and report as an error row) any PDF larger than this. The download is aborted as soon as it crosses the limit, so oversized files do not fill memory.

## `proxyConfiguration` (type: `object`):

Optional. Most PDF hosts serve plain HTTP fine from Apify's datacenter IPs; enable Apify Proxy (or your own proxy URLs) if a publisher blocks the run. Proxy usage is billed by Apify as platform usage.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
    },
    {
      "url": "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-145.pdf"
    },
    {
      "url": "https://arxiv.org/pdf/1706.03762"
    }
  ],
  "maxPages": 200,
  "includeTables": false,
  "includePageTexts": true,
  "maxDocuments": 100,
  "maxFileSizeMb": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `url` (type: `string`):

PDF URL as supplied in the input

## `finalUrl` (type: `string`):

URL after following redirects

## `fileName` (type: `string`):

Last path segment of finalUrl

## `sizeBytes` (type: `string`):

Bytes downloaded

## `pageCount` (type: `string`):

Total pages in the PDF

## `pagesExtracted` (type: `string`):

Pages actually read (capped by maxPages)

## `title` (type: `string`):

PDF metadata title

## `author` (type: `string`):

PDF metadata author

## `subject` (type: `string`):

PDF metadata subject

## `creator` (type: `string`):

PDF metadata creator (authoring application)

## `producer` (type: `string`):

PDF metadata producer (PDF engine)

## `createdAt` (type: `string`):

PDF creation date, ISO 8601 UTC

## `modifiedAt` (type: `string`):

PDF modification date, ISO 8601 UTC

## `text` (type: `string`):

Full extracted text with normalised whitespace, capped at 1,000,000 characters

## `truncated` (type: `string`):

True when text was cut at the 1,000,000 character cap

## `pageTexts` (type: `string`):

One normalised text string per extracted page

## `tables` (type: `string`):

Extracted tables as \[{page, rows}]

## `isScanned` (type: `string`):

True when the document averages fewer than 20 characters per page

## `language` (type: `string`):

Coarse language guess (ISO 639-1)

## `scrapedAt` (type: `string`):

ISO 8601 UTC timestamp of the extraction

## `status` (type: `string`):

ok | scanned | empty | error

## `error` (type: `string`):

Why the document was not extracted (error rows only)

# 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": [
        {
            "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
        },
        {
            "url": "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-145.pdf"
        },
        {
            "url": "https://arxiv.org/pdf/1706.03762"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("subimpact/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": [
        { "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf" },
        { "url": "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-145.pdf" },
        { "url": "https://arxiv.org/pdf/1706.03762" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("subimpact/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": [
    {
      "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
    },
    {
      "url": "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-145.pdf"
    },
    {
      "url": "https://arxiv.org/pdf/1706.03762"
    }
  ]
}' |
apify call subimpact/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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