# PDF to Text Extractor – Page Text & Metadata (`justaduck/pdf-to-text-extractor`) Actor

Convert PDF to text from a list of PDF URLs: per-page text, full text, page count, word count and document properties (title, author, dates, producer). Pick page ranges like 1-3,5. Encrypted PDFs are skipped, never unlocked. No OCR, no API key. Pay only for PDFs returned with text.

- **URL**: https://apify.com/justaduck/pdf-to-text-extractor.md
- **Developed by:** [Justaduck](https://apify.com/justaduck) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.45 / 1,000 pdfs

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/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 – Page Text & Metadata

**PDF to text extractor: paste a list of PDF URLs and get the text of every page, plus the document properties, as one clean row per PDF.**

- **What you get:** one row per PDF with `text` (all selected pages), `pages` (text of each page with its page number), `pageCount`, `charCount`, `wordCount`, and the document properties `title`, `author`, `subject`, `keywords`, `creator`, `producer`, `creationDate`, `modificationDate`, `pdfVersion`, `language`, `hasForm`.
- **What it costs:** US$3.50 per 1,000 PDFs plus US$0.0005 per run start. Files that are skipped (encrypted, not a PDF, no text layer, download error) are not charged. Apify's free plan (US$5 of usage a month) covers about 1,400 PDFs. That is the price on Apify's Free plan; on paid Apify plans it goes down to US$2.45 per 1,000 PDFs, the "from" price on the Store page.
- **Try it:** Click **Start** on the prefilled form: it reads two public-domain IRS forms (W-9 and W-7) and returns 2 rows (US$0.00705) in a few seconds.

Convert PDF to text in bulk: give direct links to PDF files and the Actor downloads each file once, reads it with **pdf.js** (Mozilla's open-source PDF engine, Apache-2.0) and returns the text page by page. Choose page ranges such as `1-3,5,10-` to read only the pages you need. Use it to feed PDFs into AI and RAG pipelines, search inside reports and tender documents, or pull the text out of public forms and filings.

**Only process files you have the right to use.** This Actor reads the files you list and nothing else: it does not crawl websites, follow links on pages or search for PDFs. Password-protected and encrypted PDFs are skipped and never unlocked.

### What you can use it for

- Turn a batch of reports, manuals or contracts you own into plain text for search, summaries or an LLM / RAG pipeline (each page keeps its page number for citations).
- Read the text of public documents, for example government forms, tender documents attached to public procurement notices, or annual reports published as PDF.
- Check document properties in bulk: title, author, producer software, creation and modification dates, PDF version, whether the file contains a form.
- Read only the first page of many files (`pages`: `1`) to classify them cheaply.

### How to use the PDF to text extractor

1. Open [this Actor on Apify Store](https://apify.com/justaduck/pdf-to-text-extractor) and try it in Apify Console. A free Apify account is enough; no credit card is needed.
2. The input form is prefilled with two public-domain IRS forms (US government works). Click **Start**; the run finishes in a few seconds and returns 2 rows.
3. Replace the list in **PDF URLs** with your own direct links to PDF files (one per line, each starting with `https://`). Optionally fill **Pages** to read only some pages, and **Max PDFs** to cap the run.
4. Open the **Output** tab when the run finishes. The **Overview** view shows file, page count and text; **Document properties** shows the metadata. Export as JSON, CSV or Excel, or read the per-page text from the `pages` field.
5. To automate it, save the input as a task and **schedule** it, call the Actor through the **Apify API**, or send the results to Make, Zapier, n8n, Slack or a webhook with Apify **integrations**.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `urls` | array of strings | — (required) | Direct links to PDF files, `https://` only. Each URL is downloaded once (duplicates are read once). Links on web pages are not followed; a web page instead of a PDF is skipped. URLs with an IP address, `localhost`, a user name or password are rejected. |
| `pages` | string | all pages | Pages to read from every PDF, such as `1-3,5,10-` (`10-` = page 10 to the end). Pages that a file does not have are ignored; if none of the selected pages exist, that file is skipped. |
| `maxItems` | integer | no limit | Maximum number of PDFs to return (1–5,000). URLs after the limit are not downloaded and not charged. |

Example input:

```json
{
    "urls": [
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw7.pdf"
    ],
    "pages": "1-2",
    "maxItems": 100
}
```

### Output

A real row from the prefilled run on 2026-12-01 (the IRS Form W-7; long text shortened with `…`):

```json
{
    "url": "https://www.irs.gov/pub/irs-pdf/fw7.pdf",
    "fileName": "fw7.pdf",
    "fileSizeBytes": 97654,
    "pageCount": 1,
    "pagesReturned": 1,
    "textTruncated": false,
    "charCount": 4217,
    "wordCount": 686,
    "text": "Form W-7\n(Rev. December 2024)\nApplication for IRS Individual\nTaxpayer Identification Number\nDepartment of the Treasury\nInternal Revenue Service\n…",
    "pages": [
        { "pageNumber": 1, "text": "Form W-7\n(Rev. December 2024)\nApplication for IRS Individual\n…", "charCount": 4217 }
    ],
    "title": "Form W-7 (Rev. December 2024)",
    "author": "C:DC:TS:CAR:MP",
    "subject": "Application for IRS Individual Taxpayer Identification Number",
    "keywords": "Fillable",
    "creator": "Designer 6.5",
    "producer": "Designer 6.5",
    "creationDate": "2024-12-10T18:53:50Z",
    "modificationDate": "2024-12-10T18:53:50Z",
    "pdfVersion": "1.7",
    "language": "en-US",
    "hasForm": true,
    "sourceUrl": "https://www.irs.gov/pub/irs-pdf/fw7.pdf"
}
```

#### Fields

| Field | Type | Description |
|---|---|---|
| `url` | string | The PDF URL you gave. |
| `fileName` | string or null | Last part of the final URL (after redirects), decoded. |
| `fileSizeBytes` | integer | Size of the downloaded file in bytes. |
| `pageCount` | integer | Number of pages in the file. |
| `pagesReturned` | integer | Number of pages in `pages` (the selected pages that exist, fewer if `textTruncated`). |
| `textTruncated` | boolean | `true` when the text of the selected pages is over 3 MB: the row stops at a page boundary. Read the rest with a page range. |
| `charCount` | integer | Characters in the returned pages. |
| `wordCount` | integer | Words (runs of non-space characters) in `text`. |
| `text` | string | Text of all returned pages, pages separated by a blank line. |
| `pages` | array | `{ pageNumber, text, charCount }` for every returned page, in page order. |
| `title`, `author`, `subject`, `keywords`, `creator`, `producer` | string or null | Document properties stored in the file (`null` when the file has none). |
| `creationDate`, `modificationDate` | string or null | Dates stored in the file, as ISO 8601 UTC. `null` when missing or unreadable. |
| `pdfVersion` | string or null | PDF version from the file header, such as `1.7`. |
| `language` | string or null | Document language stored in the file, such as `en-US`. |
| `hasForm` | boolean | `true` when the file contains a fillable form (AcroForm or XFA). Only the printed text is returned, not the values typed into form fields. |
| `sourceUrl` | string | Same as `url`: the PDF the text was read from. |

**How the text is laid out:** text is returned in the order it is stored in the PDF, with a line break where the PDF starts a new line and a space between separated words. Multi-column layouts and tables come out as lines of text, not as a table structure.

### Pricing

Pay per event: **US$0.0005 per run start + US$3.50 per 1,000 PDFs** (US$0.0035 per PDF), whatever the number of pages.

| Run | PDFs returned | Cost |
|---|---|---|
| Prefilled example (2 IRS forms) | 2 | US$0.007 + US$0.0005 |
| 100 reports | 100 | US$0.35 + US$0.0005 |
| 1,000 files, first page only | 1,000 | US$3.50 + US$0.0005 |

Discounts by Apify plan (per 1,000 PDFs): Free $3.50, Bronze $3.15, Silver $2.80, Gold $2.45.

**Free plan:** Apify's free plan includes US$5 of prepaid usage every month (no credit card needed), enough for about 1,400 PDFs a month with this Actor.

**You are not charged for files that return no text:** encrypted PDFs, files that are not PDFs, scanned PDFs without a text layer, files over 50 MB, download errors and invalid URLs are skipped for free and listed with the reason in the run summary. Use **Max PDFs** or Apify's "maximum cost per run" to cap a run.

### Run summary

Every run writes a `SUMMARY` record to its key-value store with the status of every URL (`ok`, `skipped`, `failed`, `not-run`) and the reason for each skipped or failed file, for example `This PDF is password-protected…` or `Not a PDF file…`.

### Limits and behaviour

- **Encrypted PDFs are skipped.** A PDF that needs a password, or that is encrypted with permission restrictions (such as "no copying"), returns 0 characters and is not charged. The Actor never tries passwords and never removes protection or DRM. If you own the file, remove the protection yourself and run it again.
- **No OCR.** Scanned PDFs that contain only images have no text layer; they are skipped (not charged) with the reason "OCR is not included".
- **One file per URL, no crawling.** The URL must return the PDF itself. A web page that links to a PDF is skipped; the link is not followed. Redirects to another `https://` address are followed; redirects to an IP address or a non-https address are not.
- **Size:** files up to 50 MB. The text in one row is capped at 3 MB (`textTruncated`); for very long documents use page ranges.
- **Speed:** files are downloaded one after another, at most 2 requests per second per website. Measured locally on 2026-12-01: 10 IRS PDFs (242 pages, 7.9 MB) in about 8.5 seconds including downloads, peak memory about 260 MB. A run lasts at most about 55 minutes; URLs not reached are listed as `not-run`.
- **Errors:** a website that keeps failing (timeouts, HTTP 5xx) is retried 3 times; after repeated failures the remaining URLs on that website are skipped, URLs on other websites still run.
- **Memory:** 512 MB by default. Raise it to 1–2 GB in the run options for PDFs larger than about 20 MB or with thousands of pages.

### Use with AI agents (MCP)

AI agents can run this Actor through the [Apify MCP server](https://docs.apify.com/mcp) (Model Context Protocol). There are two ways to connect:

- **Load this Actor as its own tool:** add `https://mcp.apify.com?tools=justaduck/pdf-to-text-extractor` to your MCP client. The server exposes it as the tool `justaduck--pdf-to-text-extractor`.
- **Let the agent find it:** connect to `https://mcp.apify.com` (default tools). The agent can find this Actor with `search-actors`, read its input schema with `fetch-actor-details` and start it with `call-actor`.

On first connection you sign in to Apify with OAuth (or send your Apify API token as a Bearer header). The agent passes the same fields as in the Input section. A run returns its dataset ID, and the agent reads the rows with `get-dataset-items`. Runs started this way run on your Apify account and are charged as in the Pricing section; `call-actor` also accepts `maxTotalChargeUsd` in `callOptions` to cap what one run can spend.

### FAQ

**How do I convert a PDF to text without uploading it to a converter website?**
Put the PDF at a URL you control (for example your own cloud storage link with public read access) and list it in **PDF URLs**. The Actor downloads it inside your own Apify account, and the text is stored in your run's dataset.

**Can it extract text from a password-protected PDF?**
No. Encrypted and password-protected PDFs are skipped on purpose and not charged. The Actor does not try passwords or remove protection.

**Does it do OCR on scanned PDFs?**
No. Only PDFs with a text layer are read. Scanned pages without text are skipped and not charged, and the run summary says so.

**Can I get the text of each page separately?**
Yes. The `pages` field lists every returned page with its `pageNumber`, `text` and `charCount`. In the dataset export you can flatten it, or use the **Pages** input to read one page range per run.

**Does it extract tables?**
Tables come out as lines of text in reading order, not as rows and columns.

**Is it legal to extract text from a PDF?**
Extracting text from files you own, or files you have permission to process (for example public-domain government documents), is generally fine. You are responsible for having the right to process the files you list and for how you use the text.

**Is this related to Adobe or the websites I download from?**
No. This Actor is not affiliated with or endorsed by Adobe, Mozilla or any website. It uses the open-source pdf.js library to read the files you list.

### What this Actor does not do

- No crawling, no link following, no search: only the URLs you list are downloaded.
- No password cracking, no removal of encryption, permissions or DRM.
- No OCR and no third-party API: everything runs inside the Actor with pdf.js.
- No changes to the text: what is in the file is returned as it is, including any names, e-mail addresses or phone numbers the file contains. The text is stored only in your own Apify account.

### Related Actors

Actors by the same author whose results often link to PDF documents:

- **[SAM.gov Federal Contracts & Bid Opportunities](https://apify.com/justaduck/sam-gov-contract-opportunities)**: US federal contract opportunities from SAM.gov's official daily public data file.
- **[TED Tenders Scraper – EU Public Procurement](https://apify.com/justaduck/eu-ted-tenders)**: EU public tenders from the official TED API.
- **[SEC EDGAR Filings Scraper – 10-K, 8-K & Form 4](https://apify.com/justaduck/sec-edgar-filings)**: SEC filings for any list of tickers or CIK numbers, with links to the documents.
- **[Merge & Dedup Datasets – Keep Only New Items](https://apify.com/justaduck/dedup-datasets-new-items)**: merge the datasets of several runs and remove duplicates, for example before sending PDF links here.

# Actor input Schema

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

Direct links to PDF files, one per line, starting with https://. Each URL is downloaded once and read as a PDF; links on web pages are not followed and nothing is crawled. Use only files you own or have permission to process. Password-protected or encrypted PDFs are skipped (never unlocked). Duplicates are read once.

## `pages` (type: `string`):

Which pages to read from every PDF, for example 1-3,5,10- (10- means page 10 to the end). Leave empty to read all pages. Pages that do not exist in a file are ignored.

## `maxItems` (type: `integer`):

Maximum number of PDFs to return (one row per PDF). Leave empty for no limit. You pay only for PDFs returned with text.

## Actor input object example

```json
{
  "urls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw7.pdf"
  ]
}
```

# Actor output Schema

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

One dataset item per PDF with per-page text and document properties. Field descriptions are in the dataset schema.

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

SUMMARY record: the status of every PDF URL and the reason for any skipped or failed file.

# 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://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw7.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("justaduck/pdf-to-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://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw7.pdf",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("justaduck/pdf-to-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://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw7.pdf"
  ]
}' |
apify call justaduck/pdf-to-text-extractor --silent --output-dataset

```

## MCP server setup

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