# PDF Text Extractor: Fast Text from PDF Links (No OCR) (`lepidata/pdf-text-extractor`) Actor

Extract text from PDF links you supply: full text (or text per page), page count, title, word count and file size, one row per PDF. Fast text-only option with no OCR. Honors robots.txt and skips protected PDFs.

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

## Pricing

from $0.80 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 (No OCR)

Extract the text from PDF files at links you supply and get one row per PDF. It's for analysts, researchers, legal and compliance teams and developers who need the text of reports, filings, manuals or papers for search, summaries or AI pipelines.

**This is the fast text-only option.** It reads the PDF's text layer and does no OCR. For scanned PDFs (pages that are images), use our pdf-ocr Actor.

**Page limit: only the first 200 pages of each PDF are read.** Longer files still return one row with the text of pages 1 to 200, and the row says so (`truncatedAtPages: 200`, `pagesRead: 200`, `pages` = the file's full page count). Pages after 200 are not extracted.

**Input:** direct links to PDF files.

**Output:** the text of up to the first 200 pages (or text per page), page count, pages read, title, PDF version, word and character counts and file size.

Use it only on PDFs you have the right to process.

### PDF text input

- `pdfUrls`: direct PDF links, up to 1,000. Each file is downloaded once.
- `splitPages`: return `pageTexts` (one string per page) instead of `text`
- `keepLayout`: keep columns and table spacing (off by default: reading order, smaller output)
- `maxResults`: stop after this many extracted PDFs

Links on `example.com` are the example input: each returns one free `EXAMPLE_INPUT` row, nothing is fetched and nothing is charged. Replace them with your own links.

### Output fields

`url`, `finalUrl`, `fileBytes`, `pages` (full page count), `pagesRead` (pages actually read, at most 200), `truncatedAtPages` (200 when the file has more than 200 pages and the rest was not read, otherwise null), `title`, `pdfVersion`, `charCount`, `wordCount`, `truncated`, `extractedTextBytes`, `text` or `pageTexts`

Text longer than 1,000,000 characters is cut off and flagged `truncated`. The 200-page cap is separate and is flagged with `truncatedAtPages`.

Free rows (not charged):

- `protected`: the PDF is encrypted or password-protected. It is skipped, never decrypted.
- `no-text-layer`: no text found (probably a scanned PDF). Try our pdf-ocr Actor.
- `error`: the link failed. Reasons include robots.txt disallowing it, HTTP 401, 403 or 404, a login, cookie or paywall page instead of a PDF, a file over 50 MB, or an unreadable PDF. Failed links are not retried.
- `invalid-input`, `free-plan-limit`, `charge-limit-reached`.

**Example:** `{"pdfUrls":["https://www.irs.gov/pub/irs-pdf/p17.pdf"]}`

### Data source and compliance

- Fetches only the links you supply. It doesn't crawl or follow links (apart from HTTP redirects, at most 5).
- Checks each site's robots.txt first. If robots.txt disallows the file, or can't be read, the file is not fetched.
- Sends a user agent that names this Actor. No cookies, no logins, no passwords. A 401, 403 or paywall is reported as a failure and never retried.
- Encrypted or password-protected PDFs are skipped and marked `protected`. There is no decryption and no DRM bypass.
- Reads at most the first 200 pages of each file (hard cap, flagged `truncatedAtPages: 200`).
- Files up to 50 MB. Each file is held only while its text is extracted, then deleted. Nothing is stored outside the run's dataset.
- Runs default to 1 GB of memory, which also buys more CPU for long documents. Text extraction stops after 5 minutes per file; a file that hits the limit is an `error` row and is not charged.
- Text is extracted with poppler's pdftotext (GPL), run as a separate program.
- Free-plan accounts get up to 100 results per run.

**Pricing.** Pay per result: $0.80 per 1,000 PDFs ($0.0008 each), the same price on every plan, no start fee. Free status rows are never charged.

# Actor input Schema

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

Direct links to PDF files, up to 1,000. Each file is downloaded once. Only the first 200 pages of each PDF are read; longer files are flagged truncatedAtPages: 200. Scanned PDFs (no text layer) need the pdf-ocr Actor. Links on example.com are the example input: they return one free EXAMPLE_INPUT row and nothing is fetched or charged.

## `splitPages` (type: `boolean`):

Return pageTexts (one string per page, at most the first 200 pages) instead of one text field.

## `keepLayout` (type: `boolean`):

Keep the page's physical layout (columns and table spacing). Off = reading order with spaces collapsed, which is smaller.

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

Stop after this many extracted PDFs (charged rows).

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.example.com/sample.pdf"
  ],
  "splitPages": false,
  "keepLayout": false,
  "maxResults": 1000
}
```

# Actor output Schema

## `items` (type: `string`):

All rows from this run.

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

// Run the Actor and wait for it to finish
const run = await client.actor("lepidata/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.example.com/sample.pdf"] }

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

```

## MCP server setup

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