# PDF Text Extractor & Parser API - Text, Metadata, E-mails (`rel8ble/pdf-text-extractor`) Actor

PDF to text API: PDF links in (bulk), full text, page count, metadata, links, e-mails, phones and keyword hits with page numbers out. Per-PDF or per-page rows for RAG, scanned-page flag, Google Drive / Dropbox links. $0.90 per 1,000 PDFs, no start fee.

- **URL**: https://apify.com/rel8ble/pdf-text-extractor.md
- **Developed by:** [Giovanni Rich](https://apify.com/rel8ble) (community)
- **Categories:** Developer tools, AI, Lead generation
- **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 results

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 Text Extractor & Parser API - Text, Metadata, E-mails

**PDF text extractor**, **PDF to text API** and **PDF parser** in one actor: paste PDF links (one or 10,000) and get the **full text**, **page count**, **metadata** (title, author, subject, creation and modification dates, producer, PDF version, language), every **link**, **e-mail address** and **phone number** in the document, **keyword hits with page numbers** and a **scanned-page flag**, as JSON, CSV or Excel. Choose one row per PDF, or one row per page for RAG / LLM chunking.

It reads the PDF itself in pure Node.js (Mozilla pdf.js), with no headless browser, no OCR service and no API key. That keeps it fast and cheap: **200 PDFs (5,305 pages, 220 MB) in 93 seconds** in a local test on 30 Nov 2026 (the 2-PDF prefill finished in 3.2 s in the Apify cloud), and **$0.90 per 1,000 PDFs with no start fee**. Links that fail (404, a web page instead of a PDF, password-protected, too large) are reported for free.

### What you get

- **Text**: the whole document as clean text with line breaks, or page by page (`outputMode: page`, or `includePageTexts` to keep page numbers inside one row). Word count, text length and a truncation flag.
- **Metadata**: title, author, subject, keywords, creator app, producer, creation date and modification date (ISO), PDF version, document language, form (AcroForm / XFA) flag, page count.
- **Contacts and links**: e-mail addresses, valid phone numbers (international format, country detected), all URLs from link annotations and from the text, plus the list of linked domains. Handy for supplier catalogs, price lists, exhibitor lists, directories and tender documents.
- **Keyword search**: give up to 100 terms; each row gets `termHits` (count, pages, a snippet around the first hit) and `matchedTerms`. `onlyMatching` keeps only the PDFs (or pages) that contain a term, and the rest is not charged.
- **Scanned-PDF detection**: `hasTextLayer`, `scannedPages` (pages with no text) and `likelyScanned`, so you know which files need OCR instead of getting silent empty text.
- **Bulk-friendly input**: paste a whole list, duplicates are removed, `www.` links without `https://` are fixed, and Google Drive / Dropbox share links are turned into direct downloads.
- **Status on every link**: `ok`, `failed` (with the HTTP code), `not_pdf`, `too_large`, `encrypted` or `invalid_pdf`, with download and parse times. Only `ok` rows are charged.

### Sample output

Real rows from a local run on 30 Nov 2026 over 200 public IRS PDFs (`sample-output.json`, text cut for the table), search term "penalty":

| fileName | title | pageCount | wordCount | creationDate | emails | first phone | linkDomains | "penalty" hits |
|---|---|---|---|---|---|---|---|---|
| p17.pdf | 2025 Publication 17 | 142 | 174,373 | 2026-01-20 | phishing@irs.gov, spam@uce.gov | +1 800 366 4484 | irs.gov, healthcare.gov, missingkids.com | 116 (pages 5, 8, 13 ...) |
| p505.pdf | 2026 Publication 505 | 48 | 38,471 | 2026-03-31 | | +1 800 829 3676 | irs.gov, missingkids.org, fed.acipayonline.com | 39 (pages 1, 3, 5 ...) |
| f23.pdf | Form 23 (Rev. 11-2022) | 3 | 1,251 | 2022-11-02 | | +1 855 472 5540 | prometric.com, pay.gov | 0 |
| f433a.pdf | Form 433-A (Rev. 6-2026) | 8 | 3,636 | 2026-06-29 | | | irs.gov | 0 |

One row (shortened):

```json
{
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "status": "ok",
  "fileName": "fw9.pdf",
  "title": "Form W-9 (Rev. March 2024)",
  "subject": "Request for Taxpayer Identification Number and Certification",
  "creationDate": "2024-03-06T13:18:13.000Z",
  "pdfVersion": "1.7",
  "language": "en-US",
  "hasForm": true,
  "pageCount": 6,
  "text": "Form W-9\n(Rev. March 2024)\n\nRequest for Taxpayer\nIdentification Number and Certification ...",
  "textLength": 37975,
  "wordCount": 6385,
  "likelyScanned": false,
  "emails": ["phishing@irs.gov", "spam@uce.gov"],
  "phones": [{ "number": "+18007721213", "display": "+1 800 772 1213", "country": "US" }],
  "links": ["https://www.irs.gov/FormW9", "https://www.ssa.gov/", "https://www.ftc.gov/complaint"],
  "termHits": [],
  "fileSizeBytes": 140815,
  "downloadMs": 221,
  "parseMs": 159
}
```

### How to use

1. Paste your PDF links into **PDF URLs** (one per line). An empty input runs a demo on two IRS forms.
2. Pick **one row per PDF** (default) or **one row per page**.
3. Optional: a **page range** ("1-3", "10-"), **search terms**, **only matching**, **max characters**, or turn the text off to get just metadata and contacts.
4. Run, then download the dataset (JSON, CSV, Excel, XML) or read it through the API. `RUN_SUMMARY` in the key-value store lists every link with its status.

Example input for supplier price lists, only pages that mention MOQ:

```json
{
  "pdfUrls": ["https://example.com/catalog-2026.pdf", "https://drive.google.com/file/d/FILE_ID/view"],
  "outputMode": "page",
  "searchTerms": ["MOQ", "FOB", "lead time"],
  "onlyMatching": true,
  "phoneCountry": "CN"
}
```

### Pricing

Pay per result: **$0.0009 per saved row = $0.90 per 1,000 PDFs** in document mode (one row per PDF, any number of pages). In page mode every page is one row. No start fee, no monthly fee. Failed links, web pages, password-protected and oversized files, and rows dropped by `onlyMatching` are free. Set **Max charged rows** or the run's maximum cost to cap spend.

### Price compared (Apify Store, checked 30 Nov 2026)

| Actor | Users (total / 30 d) | Price per 1,000 PDFs | Start fee |
|---|---|---|---|
| **This actor** | new | **$0.90** (document mode) | none |
| automation-lab/pdf-text-extractor | 759 / 127 | $3.45 | $0.005 per run |
| memo23/pdf-text-extractor | 631 / 159 | $5.00 (+ OCR $15 / 1,000 pages) | $0.005 per run |
| gochujang/pdf-text-extractor | 316 / 30 | $5.00 + $1.00 per 1,000 pages | $0.001 per run |

For 1,000 ten-page PDFs that is $0.90 here, $3.46 at automation-lab and $15.00 at gochujang. Prices are the Store's free-tier list prices on the date above; rivals may change them. Rival speed was not measured; ours is the local figure above (download speed of the source site usually dominates). This actor does no OCR: scanned pages are flagged, not read.

### Use cases

- **RAG and LLM pipelines**: page-level rows with page numbers, ready to chunk and embed.
- **B2B lead generation**: pull e-mails, phones and websites out of supplier catalogs, trade-fair exhibitor lists, member directories and tender documents.
- **Document monitoring**: schedule a weekly run over the same links and compare `modificationDate`, `pageCount` or `textLength` to spot changed price lists, terms or filings.
- **Compliance and research**: search hundreds of reports, policies or filings for terms and get the pages they appear on.
- **Data hygiene**: find which files in a library are scanned images, password-protected or broken links.

### Integrations

Works with the Apify API, Zapier, Make, n8n, Google Sheets, Slack, webhooks and the Apify MCP server, so AI agents can call it as a tool: input is a list of PDF URLs, output is one JSON row per PDF or page, cost is $0.0009 per row.

### FAQ

**Can it read scanned PDFs?** No OCR is done. Pages without a text layer are listed in `scannedPages` and `likelyScanned` is true when half or more of the pages have no text, so you can send just those files to an OCR tool.

**What about password-protected PDFs?** They come back with status `encrypted` and are not charged. PDFs that only restrict printing or copying usually open and are extracted normally.

**How big can a file be?** Up to 500 MB (`maxFileSizeMb`, default 50). For files above ~100 MB give the run more memory and lower `maxConcurrency`.

**A site answers 403 or 429.** Turn on the Apify proxy in **Proxy configuration** and lower `maxConcurrency`. The row shows the HTTP code; it costs nothing.

**Does it crawl websites for PDFs?** No, it downloads exactly the links you give it, once each. Respect each site's terms and robots rules when you choose links.

**Is the text kept in reading order?** It follows pdf.js text order with line breaks. Multi-column layouts and tables come out line by line, not as structured tables.

Need a custom scraper or a ready dataset? Hire me on Fiverr: https://www.fiverr.com/rel8ble

# Actor input Schema

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

Direct links to PDF files, one per line (up to 10,000). Google Drive "file/d/..." share links and Dropbox links are converted to the PDF download automatically. A link that returns a web page instead of a PDF comes back as status not_pdf and is not charged.

## `outputMode` (type: `string`):

document = one row per PDF with all text joined (cheapest). page = one row per page with that page's text, links, e-mails and keyword hits; every page row is one charged result.

## `includeText` (type: `boolean`):

Turn off to get only metadata, page counts, links, e-mails, phones and keyword hits (smaller rows, same price).

## `pageRange` (type: `string`):

Read only these pages, for example "1-3" (first three), "1,5,9-12" or "10-" (page 10 to the end). Empty = all pages.

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

Stop after this many pages of each PDF (applied after pageRange). 0 = no limit.

## `maxCharsPerDocument` (type: `integer`):

Cut the text field after this many characters (textTruncated is then true; textLength keeps the full length). 0 = up to 4,000,000 characters.

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

Adds a pageTexts array \[{page, text, wordCount}] to each document row, so you keep page numbers without paying per page.

## `extractContacts` (type: `boolean`):

Finds e-mail addresses and valid phone numbers in the text (useful for supplier catalogs, exhibitor lists, price lists and directories). Links are always collected.

## `phoneCountry` (type: `string`):

Two-letter country used for phone numbers written without a + country code, for example US, GB, DE, IN. Leave empty to keep only numbers written in international (+) form.

## `searchTerms` (type: `array`):

Words or phrases to find in each PDF (up to 100). Each row gets termHits \[{term, count, pages, snippet}] and matchedTerms. Matching is case-insensitive unless caseSensitive is on.

## `caseSensitive` (type: `boolean`):

Match search terms with exact upper / lower case.

## `onlyMatching` (type: `boolean`):

Drops documents (or pages in page mode) with no search-term hit. Dropped rows are not saved and not charged.

## `includeFailedRows` (type: `boolean`):

Keeps one free row per link that could not be read (404, web page instead of PDF, password-protected, too large) with status and error, so you can see what went wrong. These rows are never charged.

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

Larger files are skipped with status too_large (not charged). Raise memory too for files above ~100 MB.

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

Stop after this many saved (charged) rows. 0 = no limit.

## `maxConcurrency` (type: `integer`):

How many PDFs are downloaded and parsed at the same time.

## `maxRequestRetries` (type: `integer`):

Retries on timeouts, 429 and 5xx answers.

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

Per download attempt.

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

Not needed for most public PDFs. Turn on the Apify proxy only if a site refuses downloads from the cloud (HTTP 403 / 429).

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw4.pdf"
  ],
  "outputMode": "document",
  "includeText": true,
  "maxPagesPerPdf": 0,
  "maxCharsPerDocument": 0,
  "includePageTexts": false,
  "extractContacts": true,
  "phoneCountry": "US",
  "caseSensitive": false,
  "onlyMatching": false,
  "includeFailedRows": true,
  "maxFileSizeMb": 50,
  "maxResults": 0,
  "maxConcurrency": 5,
  "maxRequestRetries": 3,
  "requestTimeoutSecs": 60,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `contacts` (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",
        "https://www.irs.gov/pub/irs-pdf/fw4.pdf"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("rel8ble/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",
        "https://www.irs.gov/pub/irs-pdf/fw4.pdf",
    ],
    "proxyConfiguration": { "useApifyProxy": False },
}

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

```

## MCP server setup

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