# PDF Text & Metadata Extractor (`nordic-data/pdf-text-extractor`) Actor

Download PDFs from URLs and extract plain text, per-page text, document metadata (title, author, dates, page count), outlines and a scanned-PDF flag. No OCR. $0.0049 per PDF.

- **URL**: https://apify.com/nordic-data/pdf-text-extractor.md
- **Developed by:** [Niklas Bergström](https://apify.com/nordic-data) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.90 / 1,000 pdf extracteds

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 & Metadata Extractor

Turn **PDF files at a URL** into clean JSON: the full plain text, optional per-page text, document metadata (title, author, subject, creator, producer, creation and modification dates), page count, outline/bookmarks and a flag when the file looks like a scanned (image-only) PDF.

**$0.0049 per PDF opened.** Failed downloads, non-PDF responses, encrypted files we cannot open, files over the size limit, invalid inputs and duplicates are free.

This Actor does **not** run OCR. If a PDF is a scan of a paper page you will get metadata and page count, an empty (or nearly empty) text field, and `isLikelyScanned: true`.

### What you get

| Field | Meaning |
|---|---|
| `fileName`, `finalUrl`, `fileSizeBytes`, `contentType` | The file that was fetched |
| `title`, `author`, `subject`, `creator`, `producer`, `creationDate`, `modificationDate` | PDF document info |
| `pageCount`, `pagesExtracted` | Total pages vs how many we took text from |
| `text`, `charCount` | Combined plain text from the extracted pages |
| `pageTexts` | Optional `{page, text, charCount}` array |
| `outline` | Bookmark titles (flattened) |
| `isEncrypted`, `isLikelyScanned`, `truncated` | Flags |
| `problems` | `likely-scanned`, `partial-extract`, `empty-text` |

### Use cases

- **Knowledge bases and RAG:** turn public reports, filings and manuals into text before embedding.
- **Document pipelines:** pull title, author, dates and page count from a list of PDF links.
- **Compliance and research:** extract the first N pages of many official PDFs in one run.
- **Scan detection:** find image-only PDFs that need a separate OCR step.

### Input example

```json
{
  "pdfUrls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw8ben.pdf"
  ],
  "maxPages": 100,
  "includePageTexts": true,
  "maxFileMb": 20,
  "maxConcurrency": 4
}
```

### Output example

```json
{
  "recordType": "pdf",
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "fileName": "fw9.pdf",
  "pageCount": 6,
  "pagesExtracted": 6,
  "title": "Form W-9 (Rev. March 2024)",
  "author": null,
  "charCount": 18420,
  "isLikelyScanned": false,
  "isEncrypted": false,
  "checkedAt": "2026-11-12T09:00:00Z"
}
```

(Example values.)

### How it works

Each URL is downloaded (with a size cap) and opened with the open-source [pypdf](https://pypi.org/pypdf/) library. Text is read from the PDF's text layer only — no OCR, no third-party extraction API, no login. Only the URLs you supply are requested.

### Related Actors

- [Link Preview & Open Graph Extractor](https://apify.com/nordic-data/link-preview-extractor)
- [Website SEO Audit](https://apify.com/nordic-data/website-seo-audit)
- [Bulk URL Status & Redirect Chain Checker](https://apify.com/nordic-data/bulk-url-status-redirect-checker)

# Changelog

This Actor's version history is a separate document: https://apify.com/nordic-data/pdf-text-extractor/changelog.md

# Actor input Schema

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

Direct links to PDF files, e.g. https://www.example.com/report.pdf. Up to 1,000 per run. Duplicates are skipped and never charged.

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

Text is taken from the first N pages (1-500). Metadata and the total page count are always included when the file opens.

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

Add a pageTexts array with the text of each extracted page. Turn off if you only need the combined text and metadata.

## `maxFileMb` (type: `integer`):

Skip (and do not charge) files larger than this after download starts (1-50).

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

PDFs downloaded and parsed in parallel (1-10).

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw8ben.pdf"
  ],
  "maxPages": 100,
  "includePageTexts": true,
  "maxFileMb": 20,
  "maxConcurrency": 4
}
```

# Actor output Schema

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

Main results (view: Overview).

## `runStats` (type: `string`):

Counts of delivered, hidden, invalid, duplicate and failed inputs.

# 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/fw8ben.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nordic-data/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/fw8ben.pdf",
    ] }

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

```

## MCP server setup

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