# PDF to Text Extractor: Crawl a Website for PDFs (`fulox/website-pdf-to-text`) Actor

Give it a web page and it finds every PDF linked there, downloads each one and returns text per page, Markdown, page count and metadata. Scanned pages are flagged in needsOcrPages and scanned-only files are free, not billed as text. A free inventory row shows the cost first. Pay per PDF.

- **URL**: https://apify.com/fulox/website-pdf-to-text.md
- **Developed by:** [Fulox](https://apify.com/fulox) (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/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: Crawl a Website for PDFs

Turn a site's reports, filings, manuals or policies into text for RAG, research or archives: give it PDF links or a web page, and it downloads every PDF and returns text per page, Markdown and metadata.

### What you get

- **Give it a web page and it finds every PDF linked there** (one level deeper if you ask), downloads each one and extracts it. Other PDF Actors take PDF links or files only.
- **Pages with no text layer are listed in `needsOcrPages`**, and files that are scanned only are free, instead of silent empty text billed as a result.
- **$3 per 1,000 PDFs** of up to 100 pages. Failed, blocked, duplicate and scanned-only files are free.
- **A free `inventory` row lists every PDF link found**, with the page and link text it came from, including the ones past `maxPdfs`, so you see what a bigger run would cost before paying for it.
- **Each PDF is extracted and billed once**, even when it is linked from several pages or under several URLs (same file, same SHA-256).

No OCR and no table extraction yet: pages without a text layer are flagged, not read.

### Example output

```json
{
  "type": "document",
  "url": "https://pdfobject.com/pdf/sample.pdf",
  "finalUrl": "https://pdfobject.com/pdf/sample.pdf",
  "sourcePageUrl": null,
  "anchorText": null,
  "status": "ok",
  "reason": null,
  "title": null,
  "author": null,
  "creationDate": null,
  "pageCount": 1,
  "extractedPages": 1,
  "billedEvents": 1,
  "wordCount": 416,
  "sha256": "9f2c...",
  "duplicateOf": null,
  "needsOcrPages": [],
  "text": "Sample PDF This is a simple PDF file. Fun fun fun. Lorem ipsum ...",
  "pages": [{ "page": 1, "text": "Sample PDF ...", "chars": 2710, "hasTextLayer": true }]
}
```

The first row of a run is the `inventory`: `{ "type": "inventory", "found": 34, "queued": 20, "scannedPages": 1, "links": [{ "url", "sourcePageUrl", "anchorText" }] }`.

### How to use it

1. Paste direct PDF links into **PDF links**, or pages that link to PDFs into **Web pages to scan for PDF links**.
2. Pick an output format (text per page, one text field or Markdown) and click Start.
3. Download the dataset as JSON, CSV or Excel, or connect it to Google Sheets, Make, Zapier or n8n.

### Input

| Field | What it does | Default |
|---|---|---|
| `urls` | Direct PDF links (up to 500). | one sample PDF |
| `pageUrls` | Pages to scan for PDF links (up to 50). | none |
| `crawlDepth` | 1 also scans same-site pages linked from those pages (at most 50 pages per run). | 0 |
| `sameDomainOnly` | Keep only PDF links on the page's own site. Direct links are never filtered. | true |
| `maxPdfs` | PDFs processed per run (1 to 500). | 20 |
| `maxPagesPerPdf` | Pages extracted per PDF. Longer files are `partial`. | 200 |
| `maxPdfSizeMb` | Bigger files are skipped, free. Up to 50. | 25 |
| `outputFormat` | `per_page`, `document` or `markdown`. | `per_page` |
| `password` | Tried on password-protected PDFs. | none |
| `respectRobotsTxt` | Skip pages and PDFs the site's robots.txt disallows. | true |

`status` is one of `ok`, `partial`, `scanned_only`, `encrypted`, `too_large`, `download_failed`, `blocked`, `duplicate`; `reason` says why.

### Pricing

$3 per 1,000 PDFs (event "PDF extracted", $0.003). A PDF of up to 100 pages is one event; each further 100 pages is one more. Failed, blocked, duplicate, too-large, password-protected and scanned-only files are free. Set a maximum cost per run to stay in control; the run stops when it is reached. A run also stops after 25 free results in a row (or 100 in total), and private or internal addresses (localhost, 10.x, 192.168.x) are never fetched. A very dense PDF whose rows would pass the 9 MB dataset limit is cut to the pages that fit, marked `partial`, and billed for those pages only.

### Limitations

- No OCR and no table extraction. Pages without a text layer are listed in `needsOcrPages`.
- Reading order follows the PDF's own text positions; multi-column layouts can interleave.
- Pages are fetched with plain HTTP, so PDFs behind a login or created by JavaScript are not found.
- Files over the size limit, or taking more than 60 seconds to read, are cut short or skipped (the row says so).
- Respect each site's terms: robots.txt is honored by default.

### FAQ

**Can it read scanned PDFs?** Not yet. It flags those pages (`needsOcrPages`) and does not charge for scanned-only files.

**What if the same PDF is linked twice?** You get one `ok` row; copies are free `duplicate` rows.

**How do I see what a bigger run would cost?** Read the `inventory` row: `found` is every PDF link seen, `queued` is how many this run takes.

**Is my password stored?** It is used for the run only and is never written to the output.

### Changelog

- 2026-11-10: first version.

# Actor input Schema

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

Direct links to PDF files. Each PDF is extracted once, even if listed twice.

## `pageUrls` (type: `array`):

Pages that link to PDFs (up to 50). Every PDF linked there is downloaded and extracted.

## `crawlDepth` (type: `integer`):

0 scans only the pages above. 1 also scans same-site pages linked from them (at most 50 pages per run).

## `sameDomainOnly` (type: `boolean`):

Keep only PDF links on the same host as the page that links to them (www. is ignored). Direct PDF links above are never filtered.

## `maxPdfs` (type: `integer`):

PDFs processed per run (the free inventory row lists every PDF found). Also limited by your maximum cost per run.

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

Longer files are extracted up to this page, marked partial, and billed for the pages extracted only.

## `maxPdfSizeMb` (type: `integer`):

Bigger files are skipped and not charged.

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

per_page: text and a list of pages. document: one text field. markdown: Markdown with headings and bullets. Metadata and OCR flags are always included.

## `password` (type: `string`):

Tried on every password-protected PDF. Without it, protected files are skipped and not charged.

## `respectRobotsTxt` (type: `boolean`):

Skip pages and PDFs that the site's robots.txt disallows (those PDFs are free 'blocked' rows).

## Actor input object example

```json
{
  "urls": [
    "https://pdfobject.com/pdf/sample.pdf"
  ],
  "pageUrls": [],
  "crawlDepth": 0,
  "sameDomainOnly": true,
  "maxPdfs": 20,
  "maxPagesPerPdf": 200,
  "maxPdfSizeMb": 25,
  "outputFormat": "per_page",
  "respectRobotsTxt": true
}
```

# Actor output Schema

## `documents` (type: `string`):

One inventory row listing every PDF found, then one row per PDF with its text, metadata and status. Failed, blocked, duplicate and scanned-only files are listed but not charged.

## `summary` (type: `string`):

Counts for the run: PDFs found and handled, events charged, results by status, stop reason.

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

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fulox/website-pdf-to-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/jAOkKo20QCWHIDahi/builds/Dbu71UGiiONLISTMP/openapi.json
