# Bulk PDF Text Extractor - URLs to Text, Pages & Metadata (`beryline_pastel/bulk-pdf-text-extractor`) Actor

Download PDFs from a list of URLs and extract clean structured text (whole document or per page), page count, word count, and document metadata for RAG and LLM pipelines. Flags scanned PDFs. No OCR.

- **URL**: https://apify.com/beryline_pastel/bulk-pdf-text-extractor.md
- **Developed by:** [Beryline Pastel](https://apify.com/beryline_pastel) (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 $3.00 / 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/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

## Bulk PDF Text Extractor - URLs to Text, Pages & Metadata

Turn a list of **PDF links into clean, structured text**. For every URL the actor downloads the PDF, extracts the text page by page, rebuilds readable line breaks, and returns one dataset row with the text, page count, word count and document metadata. Built for RAG / LLM pipelines, document search, compliance archives and research datasets.

**Important: this actor reads the text layer of a PDF. It does not do OCR.** Scanned PDFs (images of pages) are detected and flagged with `likelyScanned: true` so you know to run them through an OCR tool.

### What you get

- **Text per page or whole document**: `outputFormat: "pages"` returns `[{ page, text, charCount }]`; `"text"` returns one string.
- **Readable layout**: line breaks are reconstructed from the position of each text fragment, so paragraphs and table rows do not collapse into one long line. Complex multi-column layouts and tables are returned in reading order of the PDF's text, not as real tables.
- **Metadata**: title, author, subject, creator, producer, creation date, modification date, PDF version (ISO dates).
- **Quality signals**: `pageCount`, `pagesExtracted`, `truncated`, `totalChars`, `wordCount`, `likelyScanned`.
- **Safe downloads**: 60 s timeout, size limit enforced from `Content-Length` and again while streaming, and a `%PDF` header check, so HTML error pages and huge files never get parsed.
- **One row per URL**, in the same shape whether it succeeded or failed.

### Use cases

- Feed PDFs into a vector database or LLM prompt
- Index annual reports, contracts, papers, manuals, price lists
- Check which PDFs in a list are scanned (no text) before choosing an OCR service
- Archive document text and metadata in a searchable dataset

### Input

| Field | Description |
|---|---|
| `pdfUrls` | Direct links to PDF files (http/https). Duplicates are removed |
| `maxPagesPerPdf` | Extract only the first N pages (default 200). Longer files get `truncated: true` |
| `maxFileSizeMb` | Reject files larger than this (default 50) |
| `outputFormat` | `pages` (default, array per page) or `text` (one string) |
| `includeMetadata` | Include the metadata object (default true) |
| `concurrency` | PDFs processed in parallel (default 3) |

```json
{
  "pdfUrls": ["https://pdfobject.com/pdf/sample.pdf"],
  "maxPagesPerPdf": 200,
  "outputFormat": "pages",
  "includeMetadata": true
}
```

### Output (one row per PDF)

```json
{
  "url": "https://pdfobject.com/pdf/sample.pdf",
  "status": "ok",
  "error": null,
  "fileSizeBytes": 18810,
  "pageCount": 1,
  "pagesExtracted": 1,
  "truncated": false,
  "metadata": {
    "title": "sample",
    "author": "Philip Hutchison",
    "subject": null,
    "creator": "Pages",
    "producer": "Mac OS X 10.5.4 Quartz PDFContext",
    "creationDate": "2008-07-01T05:24:47.000Z",
    "modDate": "2008-07-01T05:24:47.000Z",
    "pdfVersion": "1.3"
  },
  "pages": [{ "page": 1, "text": "Sample PDF\n\nThis is a simple PDF file. Fun fun fun. ...", "charCount": 2883 }],
  "totalChars": 2883,
  "wordCount": 416,
  "likelyScanned": false
}
```

Failed rows look like `{ "url": "...", "status": "error", "error": "HTTP 403", "errorCode": "http", "pageCount": null, "pagesExtracted": 0 }`. Error codes: `invalid-url`, `http`, `network`, `timeout`, `too-large`, `not-pdf`, `encrypted`, `corrupt`.

A run summary (counts, pages, characters, seconds) is stored in the key-value store as `SUMMARY`.

### Pricing

Pay per event: **$0.003 per successfully extracted PDF; failed downloads and non-PDFs are free.** One event is charged per PDF regardless of its page count (up to your page limit). 1,000 PDFs = $3. Set *Max cost per run* to cap spending; the actor stops cleanly when the limit is reached.

### FAQ

**Does it OCR scanned documents?** No. If a PDF has fewer than 30 characters per page on average, the row is marked `likelyScanned: true` with a note. You are still charged for such a PDF because it was downloaded and parsed successfully; filter on `likelyScanned` if you want to skip them later.

**Password-protected PDFs?** They return an `encrypted` error and are not charged.

**Do you support PDFs behind a login?** No. Only publicly reachable URLs; no cookies or credentials are sent.

**Why is the text order odd for tables or columns?** PDFs store positioned text fragments, not tables. The actor groups fragments into lines by vertical position. Multi-column pages may interleave columns.

**Memory?** The default is 512 MB because the PDF engine needs more than 256 MB for larger files. For PDFs near the size limit with high concurrency, raise memory or lower `concurrency`.

### Limits

No OCR; no images or table structure extraction; no form-field values; text only from the PDF text layer; files above `maxFileSizeMb` (default 50 MB) and pages above `maxPagesPerPdf` are skipped; 60 second download timeout per file.

### Use with AI agents (MCP)

This Actor works as a tool for Claude, ChatGPT, Cursor and other MCP clients through the Apify MCP server:

```
https://mcp.apify.com?tools=beryline_pastel/bulk-pdf-text-extractor
```

Example prompt: *"Extract the text of these PDF URLs page by page so I can index them for RAG."*

### Related tools by the same author

- [Bulk Core Web Vitals Auditor](https://apify.com/beryline_pastel/bulk-core-web-vitals-auditor)
- [Bulk Domain Checker (expiry, WHOIS, DNS, SSL)](https://apify.com/beryline_pastel/bulk-domain-checker)
- [Bulk Phone Number Validator (E.164)](https://apify.com/beryline_pastel/bulk-phone-number-validator)
- [Broken Link & Redirect Checker](https://apify.com/beryline_pastel/broken-link-redirect-checker)
- [Bulk Email Validator (MX, disposable, typos)](https://apify.com/beryline_pastel/bulk-email-validator-mx-disposable)

# Actor input Schema

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

Direct links to PDF files (http or https). One output row per URL. Duplicates are removed. Each successfully extracted PDF is one billable event.

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

Only the first N pages of each PDF are extracted. Longer PDFs are marked truncated=true (still one event).

## `maxFileSizeMb` (type: `number`):

PDFs larger than this are rejected without being fully downloaded and are not charged. Checked against Content-Length and while streaming.

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

'pages' returns an array with text and character count per page. 'text' returns the whole document as one string (pages separated by a blank line).

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

Add title, author, subject, creator, producer, creation/modification dates and PDF version to each row.

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

How many PDFs are downloaded and parsed in parallel. Higher values need more memory.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://pdfobject.com/pdf/sample.pdf",
    "https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf"
  ],
  "maxPagesPerPdf": 200,
  "maxFileSizeMb": 50,
  "outputFormat": "pages",
  "includeMetadata": true,
  "concurrency": 3
}
```

# Actor output Schema

## `results` (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://pdfobject.com/pdf/sample.pdf",
        "https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("beryline_pastel/bulk-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://pdfobject.com/pdf/sample.pdf",
        "https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("beryline_pastel/bulk-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://pdfobject.com/pdf/sample.pdf",
    "https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf"
  ]
}' |
apify call beryline_pastel/bulk-pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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