# PDF to Text Extractor: text from PDF URLs, batch (`glistening_film/pdf-text-extractor`) Actor

Extract per-page text and metadata from text-based PDFs by URL, up to 50 per run. $0.003 per successfully extracted PDF, no start fee. Scanned, encrypted, failed or corrupt files are reported but never charged. Built for RAG, indexing and search pipelines.

- **URL**: https://apify.com/glistening\_film/pdf-text-extractor.md
- **Developed by:** [Yodesla](https://apify.com/glistening_film) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$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/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 to Text Extractor: batch, pay only for successful PDFs

Extract clean per-page text and document metadata from **text-based PDFs** by URL, up to 50 per
run. **$0.003 per successfully extracted PDF, no start fee, no OCR.** Built for automation
pipelines (RAG ingestion, document indexing, search, data entry).

### Use cases

- Ingesting public PDFs (forms, papers, reports) into a RAG or search index
- Document indexing and data-entry pipelines
- Extracting the text layer before table or layout processing
- Bulk extraction from a list of PDF URLs, paying only for the PDFs that worked

### What you get

For each PDF:

- `status`: `ok`, `no_text_layer`, `encrypted`, `invalid_pdf`, `download_failed`,
  `extraction_failed`, `resource_limit`, or `error`
- `text`: text from the requested pages, up to your configured page limit
- `pages[]`: text per page, with character counts (optional)
- `pageCount`, `pagesExtracted`, `truncated`
- `metadata`: title, author, creator, producer, creation and modification dates
- `processingMs`, and `error` with a plain-language reason when something fails

### Pricing: you only pay for PDFs that worked

**One event per successfully extracted PDF ($0.003).** Downloads that fail, scanned (image-only)
PDFs, password-protected PDFs and corrupt files are **reported in the output but never charged**.
There is no start fee. Page extraction errors and resource-limit failures are also uncharged.
The run checks your spending limit before each PDF and stops cleanly when it's reached.
A successful extraction of your configured page range is charged once even when `truncated`
is true; pages beyond that range are not processed.

### Accuracy

The output is tested against an independent reference extractor (Poppler `pdftotext`) on real
public documents (IRS forms, arXiv papers, a NIST publication): **word recall 97.9–100%, word
precision 96.5–100%**. Reading order can differ on multi-column layouts. The test suite also
checks exact text on authored documents, including numbers, currency and accented characters.

### Limits (by design)

- **No OCR.** PDFs with no extractable non-whitespace text in the requested pages return
  `no_text_layer`. Mixed image/text documents return only their existing text layer; images
  are not transcribed.
- Max 50 URLs per run, max 50 MB per file (default 25), and max 500 pages per PDF (default 200).
- Only public `http(s)` links; local and private-network addresses are refused.
- Each PDF has a 25-second processing deadline and a 500,000-character text limit. Hosted
  parsing runs in a separate process with a 384 MiB memory limit. Files exceeding these limits
  return `resource_limit` without an extraction charge.
- No table structure detection: tables come through as text.

### FAQ

**Does it work on scanned PDFs?** No — there is no OCR. PDFs with no text layer return
`no_text_layer` and are not charged. Use an OCR actor for scans.

**Am I charged for failed downloads or encrypted PDFs?** No. Only successful extractions are
charged; every other outcome is reported with a status and not charged.

**Can I extract only certain pages?** Yes. You configure the page range/limit per run; pages
beyond it are not processed, and a truncated-but-successful extraction is charged once.

**How are tables handled?** There is no table structure detection; tables come through as text.

**What are the limits?** Up to 50 public `http(s)` URLs per run, 50 MB per file (default 25),
500 pages per PDF (default 200), a 25-second processing deadline and a 500,000-character text
limit per PDF.

**What does it cost?** $0.003 per successfully extracted PDF, no start fee.

### Input example

```json
{
  "pdfUrls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"],
  "maxFileSizeMb": 25,
  "maxPagesPerPdf": 200,
  "includePageText": true
}
```

# Actor input Schema

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

Public http(s) links to PDF files (max 50 per run). Only PDFs with a text layer are supported; scanned PDFs are reported as no\_text\_layer and not charged.

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

Larger files are skipped (not charged). Hard cap 50.

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

Pages beyond this are not extracted; the result is marked truncated. Hard cap 500.

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

Also return text split by page (the full text is always returned).

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
  ],
  "maxFileSizeMb": 25,
  "maxPagesPerPdf": 200,
  "includePageText": true
}
```

# Actor output Schema

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

One dataset item per input URL: status (ok, no\_text\_layer, encrypted, invalid\_pdf, download\_failed, extraction\_failed, resource\_limit or error), full text, optional per-page text, page counts, metadata and error reason. Only items with status ok are charged.

# 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("glistening_film/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("glistening_film/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 glistening_film/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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