# PDF to Text Extractor - Public PDF URLs, Page by Page (`ahmed.fouaad82/public-pdf-text`) Actor

PDF to text extractor for public PDF URLs: one row of text per page with page numbers, for search, RAG and LLMs. Text-layer PDFs, no OCR. $0.02/page.

- **URL**: https://apify.com/ahmed.fouaad82/public-pdf-text.md
- **Developed by:** [Ahmed Fouad](https://apify.com/ahmed.fouaad82) (community)
- **Categories:** Developer tools, AI, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00 / 1,000 pdf pages

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 - Public PDF URLs, Page by Page

Convert **PDF to text**: extract searchable text from public PDF URLs, one dataset row per page. Bounded isolated parser, page limits, no OCR or login.

### Quick start

Run the defaults or replace `urls` with public PDF document URLs you are authorized to process. The default is Mozilla PDF.js basicapi.pdf (Apache-2.0 test repository). No proxy, browser, account or API key is required.

```json
{
  "urls": [
    "https://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/basicapi.pdf"
  ],
  "maxResults": 3,
  "maxPages": 3
}
```

### Pricing

PPE `result`: **$20 per 1,000 pages ($0.02/page)**. First **25 rows per run are free**; only subsequent successful rows are charged. Errors are recorded in SUMMARY, never billed. Stops when the event spending limit is reached. No startup event or usage surcharge.

### Inputs

- `urls`: 1-50 public HTTP(S) URLs. Check each source terms and reuse rights first; prohibited, login and private-network resources are not supported. Default: `['https://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/basicapi.pdf']`.
- `maxResults`: Maximum successful dataset rows across all sources. Default: `100`.
- `keyword`: Optional case-insensitive literal text filter; no regular expressions. Default: \`\`.
- `delayMillis`: Polite request delay, increased to honor robots crawl-delay. Default: `1000`.
- `maxResponseMb`: Hard download size limit; oversized resources fail without bypassing. Default: `5`.
- `maxPages`: Only the first N pages are parsed; totalPages retains source document count. Default: `20`.
- `maxCharsPerPage`: Truncate long page text and flag textTruncated. Default: `20000`.

### Dataset

One row per parsed PDF page (including pages with no selectable text).

- `sourceUrl` (string): sourceUrl from the public source; absent source values may be null.
- `pageNumber` (integer): pageNumber from the public source; absent source values may be null.
- `totalPages` (integer): totalPages from the public source; absent source values may be null.
- `text` (string): text from the public source; absent source values may be null.
- `textTruncated` (boolean): textTruncated from the public source; absent source values may be null.
- `hasText` (boolean): hasText from the public source; absent source values may be null.
- `fetchedAt` (string): fetchedAt from the public source; absent source values may be null.

JSON/CSV/Excel export is provided by Apify datasets. SUMMARY gives total rows, source errors and stopReason. STATE supports migration resume; exactly-once delivery across a process failure between dataset write and state persistence is not guaranteed.

### Limits and safety

Robots checked before every source/redirect; fail closed when unresolved. HTTP(S) public destinations only, DNS pinned to validated public addresses; private/reserved IPs blocked. 1-second minimum host delay, bounded requests and response sizes; no CAPTCHA, login or access-control bypass. No contacts/author-profile extraction. User is responsible for source terms, privacy and redistribution rights.

No OCR, image rendering, tables/layout reconstruction, attachments, JavaScript execution or password decryption. Scanned pages return `hasText:false`; textTruncated flags character caps. Each PDF is parsed in a memory-limited worker with a 15-second deadline. Page and character limits apply; up to 50 URLs. This is a text utility, not a document search index.

# Actor input Schema

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

1-50 public HTTP(S) URLs. Check each source terms and reuse rights first; prohibited, login and private-network resources are not supported.

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

Maximum successful dataset rows across all sources. First 25 pages of every run are free.

## `keyword` (type: `string`):

Optional case-insensitive literal text filter; no regular expressions.

## `delayMillis` (type: `integer`):

Polite request delay, increased to honor robots crawl-delay.

## `maxResponseMb` (type: `integer`):

Hard download size limit; oversized resources fail without bypassing.

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

Only the first N pages are parsed; totalPages retains source document count.

## `maxCharsPerPage` (type: `integer`):

Truncate long page text and flag textTruncated.

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/basicapi.pdf"
  ],
  "maxResults": 100,
  "keyword": "",
  "delayMillis": 1000,
  "maxResponseMb": 5,
  "maxPages": 20,
  "maxCharsPerPage": 20000
}
```

# Actor output Schema

## `dataset` (type: `string`):

Successful extracted rows

## `records` (type: `string`):

STATE and SUMMARY

# 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://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/basicapi.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ahmed.fouaad82/public-pdf-text").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://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/basicapi.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("ahmed.fouaad82/public-pdf-text").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://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/basicapi.pdf"
  ]
}' |
apify call ahmed.fouaad82/public-pdf-text --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ahmed.fouaad82/public-pdf-text"
        }
    }
}
```

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/gn5NOMX78SuZYswA0/builds/mGYuGpSOOytyvKOz8/openapi.json
