# PDF Text Extractor for LLMs: text per page from PDF URLs (`steadydata/pdf-text-extractor`) Actor

Plain text extraction from PDF files by URL, up to 200 files per run: one row per page (or one per file) with the text, page count, title, author, dates, producer and file size, plus whether the page has a text layer at all. Pay per page delivered.

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

## Pricing

$1.00 / 1,000 page 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 Extractor: text per page from PDF URLs, with metadata

Plain text from PDF files by URL, up to 200 files per run: one row per page (or one per file) with the text, page count, title, author, dates, producer and file size, plus whether the page has a text layer at all. Pay per page delivered.

### Why this scraper

- **Only delivered results are charged.** Inputs that fail come back as clear error
  records at no cost.
- Pure Python parsing, no browser and no OCR engine: a 15-page research paper comes back page by page in a few seconds. Measured on the platform: two files, six pages, for a hundredth of a cent.
- One row per page (or one per file), with the character count and a `hasTextLayer` flag per page, so scanned pages show up as exactly that instead of silently empty. The document's own metadata rides along: title, author, subject, creation and modification dates as ISO timestamps, producer, file size, encryption flag. Every URL is checked against its host's robots.txt before the file is fetched, and files above 50 MB are refused for free.

### Who this is for

Paste direct PDF links in `urls` (up to 200 per run). Leave `mergePages` off for one row per page, or switch it on for one row per file with all pages joined (that row counts as one delivered page). `maxPagesPerFile` caps the cost per file. Every row carries the URL, file name, page number, page count, text, character count, text-layer flag, title, author, subject, dates, producer, file size and encryption flag.

### Who this is not for

This reads the text layer; a scanned PDF (images of pages) comes back with empty text and `hasTextLayer` false on every page, because there is nothing to read without OCR. Title, author and subject are whatever the producing software wrote into the file, and most files carry no title or subject at all (a research paper from LaTeX has a producer but no author field). Reading order follows the PDF's internal order, which can differ from the visual layout in multi-column documents. Password-protected files and pages that pypdf cannot parse are reported, not charged.

### Input example

```json
{
    "urls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ],
    "mergePages": false,
    "maxPagesPerFile": 200
}
```

### Output example

- `url`
- `fileName`
- `page`
- `pageCount`
- `text`
- `characters`
- `hasTextLayer`
- `title`
- `author`
- `subject`
- `createdAt`
- `modifiedAt`
- `producer`
- `fileBytes`
- `encrypted`

Error codes: `INVALID_URL`, `ROBOTS_DISALLOWED`, `NOT_A_PDF`, `FETCH_FAILED`, `TOO_LARGE`, `BLOCKED`.

One delivered row looks like this:

```json
{
  "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
  "fileName": "dummy.pdf",
  "pageCount": 1,
  "title": null,
  "author": "Evangelos Vlachogiannis",
  "subject": null,
  "createdAt": "2007-02-23T17:56:37",
  "modifiedAt": null,
  "producer": "OpenOffice.org 2.1",
  "fileBytes": 13264,
  "encrypted": false,
  "page": 1,
  "text": "Dummy PDF file",
  "characters": 14,
  "hasTextLayer": true,
  "status": "ok"
}
```

### Related actors from steadydata

- [sitemap-urls](https://apify.com/steadydata/sitemap-urls): find every PDF a site lists in its sitemap
- url-status-redirect-checker (publishing soon): check which PDF links still answer
- [google-patent-details](https://apify.com/steadydata/google-patent-details): patent texts without the PDF
- Used together with sitemap-urls and webpage-to-markdown in a recipe: [Feed a RAG pipeline with clean page text](https://steadydata.io/recipes/rag-pipeline-clean-page-text.html).

### Pricing

Pay per event: one `page-extracted` event per delivered result. No charge for inputs
that fail, no separate platform-usage surcharge.

**Free Apify plan:** this actor delivers up to 25 rows per run for accounts on the Apify free
plan, and then stops with a message. That limit is set by us, not by Apify. It exists so the
actor keeps paying for itself for the people who do pay. Any paid Apify plan runs it at full
size, billed per delivered row, with failed rows never charged.

**Reviews:** if this actor saves you time, a short review on this page is the one thing that
helps most. Ratings are what other buyers look at first, and we have no other way to ask.

### FAQ

**Does it do OCR?** No. It extracts the existing text layer; the `hasTextLayer` flag tells you which pages would need OCR.

**Can I get the whole document as one text?** Yes, switch on `mergePages`; you pay one event for the file instead of one per page.

**What about very large files?** Files above 50 MB are refused as a free error row; use `maxPagesPerFile` to cap long documents.

**Where do the URLs come from?** Any direct PDF link: your own site, the Sitemap URLs actor below, a search result. A page that returns HTML instead of a PDF is a free `NOT_A_PDF` error row.

**Do I pay for a file that fails?** No. Only delivered pages (or merged files) are charged.

**Is personal data collected?**
`page` is 1-based, or 0 for a merged file; `characters` counts the cleaned text; `createdAt` and `modifiedAt` are the PDF info dates as ISO timestamps without a time zone.

**What happens when the source changes?**
Sources change from time to time; that is the nature of this work. The actor is
monitored daily and fixed fast, and while it is broken you are not charged, because
only delivered results cost anything.

# Changelog

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

# Actor input Schema

## `urls` (type: `array`):

One URL per row, up to 200. Direct links to PDF files.

## `mergePages` (type: `boolean`):

Off: one row per page. On: one row per file with all pages joined; that row counts as one delivered page.

## `maxPagesPerFile` (type: `integer`):

Cost ceiling per file, from the first page.

## Actor input object example

```json
{
  "urls": [
    "https://arxiv.org/pdf/1706.03762"
  ],
  "mergePages": false,
  "maxPagesPerFile": 200
}
```

# Actor output Schema

## `results` (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 = {
    "urls": [
        "https://arxiv.org/pdf/1706.03762"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadydata/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 = { "urls": ["https://arxiv.org/pdf/1706.03762"] }

# Run the Actor and wait for it to finish
run = client.actor("steadydata/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 '{
  "urls": [
    "https://arxiv.org/pdf/1706.03762"
  ]
}' |
apify call steadydata/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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