# PDF Text Extractor: Bulk PDF to Text, Metadata and Links (`joesimo/pdf-text-extractor`) Actor

Extract text from PDF files at any public URL, or from every PDF linked on a web page. Full text and text per page, title, author, dates, page count, word count, links and bookmarks, with a flag for scanned PDFs. Bulk, fast, no browser, no login.

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

## Pricing

from $2.00 / 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.

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: Bulk PDF to Text, Metadata and Links

Extract the text of PDF files at any public URL, in bulk. Paste PDF links, or paste web pages that link to PDFs (report libraries, investor relations pages, government document lists) and every linked PDF is read. You get one clean row per PDF with the full text, the text of each page, title, author, subject, creation and modification dates, page count, word count, file size, SHA-256 hash, the web links inside the PDF and its bookmarks (table of contents). Scanned PDFs without a text layer are flagged and not charged.

Built on Mozilla pdf.js. No browser, no login, no proxy.

### What you get

| Field | What it is |
|---|---|
| `text` | Full text in reading order, with line breaks and blank lines between blocks |
| `pages` | `pageNumber`, `wordCount` and `text` for every page (or one row per page with `outputFormat: "pages"`) |
| `title`, `author`, `subject`, `keywords` | Document properties (Info dictionary, then XMP) |
| `creator`, `producer`, `pdfVersion`, `language` | Which tool made the file, PDF version, declared language |
| `creationDate`, `modificationDate` | ISO 8601 dates in UTC |
| `pageCount`, `pagesExtracted`, `wordCount`, `charCount` | Size of the document |
| `emptyPages`, `needsOcr`, `status` | `ok`, `partial_text` (more than half the pages have no text) or `no_text` (scanned, free) |
| `links` | Web links in the PDF with the page they are on (`includeLinks: true`) |
| `outline` | Bookmarks with level and target page |
| `hasForm`, `hasSignatures`, `encrypted` | Fillable form, digital signature and encryption flags |
| `fileName`, `fileSizeBytes`, `sha256`, `finalUrl`, `sourcePage`, `linkText` | File facts, redirect target, and where the link was found |

### Input

```json
{
    "pdfUrls": [
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://www.irs.gov/pub/irs-pdf/p17.pdf"
    ],
    "pageUrls": ["https://www.irs.gov/forms-pubs/about-form-w-9"],
    "maxPdfsPerPage": 20,
    "outputFormat": "document"
}
```

- `pdfUrls`: direct links to PDF files. Redirects are followed, and files in public buckets or an Apify key-value store work too.
- `pageUrls`: web pages whose links to `.pdf` files should be extracted (up to `maxPdfsPerPage` each, `sameSiteOnly` optional).
- `outputFormat`: `document` (one row per PDF, best for search and AI pipelines) or `pages` (one row per page plus a summary row per PDF, best for citations and chunking).
- `maxPagesPerPdf` (0 = all), `maxFileSizeMb` (50), `maxTextChars` per row (1,000,000; longer text goes to the key-value store and the row gets `fullTextUrl`).
- `includePageText`, `includeMetadata`, `includeOutline` (on) and `includeLinks` (off, turn it on to list the web links inside each PDF).
- `password`: optional, for protected PDFs that you own or may open. Stored as a secret input.
- `respectRobotsTxt` (on), `concurrency` (2), `timeoutSecs` (90).

Empty input `{}` runs a small demo on two public IRS forms.

### Output

Row from a real cloud run (text and pages shortened):

```json
{
    "type": "pdf",
    "status": "ok",
    "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "fileName": "fw9.pdf",
    "title": "Form W-9 (Rev. March 2024)",
    "subject": "Request for Taxpayer Identification Number and Certification",
    "creator": "Designer 6.5",
    "creationDate": "2024-03-06T13:18:13.000Z",
    "language": "en-US",
    "pdfVersion": "1.7",
    "hasForm": true,
    "pageCount": 6,
    "pagesExtracted": 6,
    "wordCount": 6302,
    "charCount": 37759,
    "emptyPages": 0,
    "needsOcr": false,
    "fileSizeBytes": 140815,
    "sha256": "2d420cbb4123dcf1fb82595b2359cfbb5d81f00b9df9d359fcc7af361d093f53",
    "text": "Form W-9\n(Rev. March 2024)\nRequest for Taxpayer\nIdentification Number and Certification\n...",
    "pages": [{ "pageNumber": 1, "wordCount": 925, "text": "Form W-9\n(Rev. March 2024)\n..." }],
    "links": [],
    "outline": [],
    "charged": true
}
```

Free rows explain what went wrong: `failed` (HTTP error or network error), `not_pdf`, `too_large`, `encrypted`, `robots_blocked`, `invalid_input`, and one `page_summary` row per web page with the number of PDF links found.

Export to CSV, Excel or JSON, or call it from the Apify API, Make, Zapier, n8n or an AI agent.

### Pricing

Pay per event: **$0.002 per PDF extracted** ($2 per 1,000 PDFs), which covers the first 50 pages. Longer documents add **$0.0001 per page after page 50** ($0.10 per 1,000 extra pages), so a 150-page report costs $0.012. Scanned PDFs with no text, failed downloads, non-PDF responses, files over the size limit, protected files, robots.txt skips and page summary rows are free. Set "Maximum cost per run" and the run stops at that budget.

### Use cases

- Turn a folder of PDF reports, filings or manuals into text for search, RAG or an LLM.
- Pull every PDF from an annual report or investor relations page in one run.
- Index PDF metadata (title, author, dates, page count) for a document library or audit.
- Watch a document list on a schedule and spot changed files with `sha256`.
- Collect the links and bookmarks inside long PDFs.

### Limits and notes

- Text comes from the PDF text layer. Scanned PDFs (images of pages) have no text layer: they are flagged with `status: "no_text"` and `needsOcr: true` and not charged. OCR is not included.
- Reading order follows the PDF content order. Multi-column layouts and tables come out as lines of text, not as table cells.
- PDF links inside web pages are found in the HTML. Links that a page builds with JavaScript are not seen.
- Only process files you are allowed to use. The downloader identifies itself with a descriptive User-Agent, respects robots.txt, keeps a gap between requests per host and refuses private network addresses. Email links inside PDFs are left out.
- Not affiliated with Adobe or Mozilla.

Questions or a field you want added: joesimo@mail.grokbot.com

# Actor input Schema

## `pdfUrls` (type: `array`):

Direct links to PDF files, one per line. Redirects are followed. Files stored in an Apify key-value store or any public bucket work too.

## `pageUrls` (type: `array`):

Pages that link to PDF files (report libraries, investor relations pages, document lists). Every link to a .pdf file in the page HTML is extracted. Links built by JavaScript are not seen.

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

Upper limit of PDF links taken from each web page.

## `sameSiteOnly` (type: `boolean`):

Skip PDF links that point to another domain than the web page.

## `outputFormat` (type: `string`):

One row per PDF is best for search and AI pipelines. One row per page is best for citations and chunking.

## `includePageText` (type: `boolean`):

In one-row-per-PDF mode, also add a pages array with the text and word count of every page.

## `includeMetadata` (type: `boolean`):

Author, subject, keywords, creator, producer, creation and modification dates, language, PDF version and form or signature flags.

## `includeLinks` (type: `boolean`):

Web links found in the PDF (clickable link annotations), with the page they are on. Email links are left out. Off by default because reading annotations about doubles the processing time of long documents.

## `includeOutline` (type: `boolean`):

The PDF outline (table of contents bookmarks) with level and page number.

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

Read only the first N pages of each PDF. 0 reads every page.

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

Larger files are skipped (free row with type too_large). Raise run memory for files above 100 MB.

## `maxTextChars` (type: `integer`):

Longer documents keep the first part in the row and the full text in the run's key-value store (fullTextUrl).

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

Optional. Password for protected PDFs that you own or are allowed to open. Used for every file in the run.

## `respectRobotsTxt` (type: `boolean`):

Skip files and pages that robots.txt disallows for all user agents. Turn off only for your own site.

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

Files downloaded at the same time, with a short gap per host.

## `timeoutSecs` (type: `integer`):

Per request. Large files on slow servers may need more.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
  ],
  "maxPdfsPerPage": 20,
  "sameSiteOnly": false,
  "outputFormat": "document",
  "includePageText": true,
  "includeMetadata": true,
  "includeLinks": false,
  "includeOutline": true,
  "maxPagesPerPdf": 0,
  "maxFileSizeMb": 50,
  "maxTextChars": 1000000,
  "respectRobotsTxt": true,
  "concurrency": 2,
  "timeoutSecs": 90
}
```

# Actor output Schema

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

No description

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

// Run the Actor and wait for it to finish
const run = await client.actor("joesimo/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 = { "pdfUrls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"] }

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

```

## MCP server setup

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