# PDF Text Extractor - Text, Tables & Metadata from PDFs (`goldstandardweb/pdf-text-extractor`) Actor

Extract text, tables, links and metadata from PDF links or uploaded files. One row per PDF, flags scans with no text layer, clear errors for broken or locked files. Pay only for PDFs with text.

- **URL**: https://apify.com/goldstandardweb/pdf-text-extractor.md
- **Developed by:** [Josh Zoerner](https://apify.com/goldstandardweb) (community)
- **Categories:** 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

Pay per event

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, Tables & Metadata from PDFs

**Paste PDF links (or upload files) and get one row per PDF. Each row has the full text in reading order and the tables as rows and cells. It also has every clickable link with its page, and the document's title, author, dates and page count. You pay only for PDFs that actually had text: 1,000 PDFs cost $5, however many pages they have (up to 500 pages each by default, 5,000 at most).**

- **Proof:** the sample table below comes from real runs on Nov 16, 2026 (UTC) on three US government PDFs (107 pages, 3.2 MB). On the Apify platform, the two example PDFs (45 pages) were read in about 2 seconds.
- **Guarantee:** some files can't be read. Scanned PDFs with no text layer, password-locked files and broken files are examples. So are links that turn out to be web pages, and files a site's robots.txt does not allow. All of them come back with the reason and a next step, **free**. Each PDF is read on its own with a time limit and a memory cap. That includes a stop for "zip bomb" files that expand to gigabytes. So a bad PDF ends as a free error row instead of stopping the run.
- **Next step:** click **Try for free**. The example input reads two real PDFs (an IRS form and the BLS jobs report) in under a minute.

### Who it's for

- **Analysts and researchers** pulling numbers and text out of reports, filings and statistical releases, without copy-pasting from a PDF viewer.
- **Teams building search indexes or document pipelines** that need clean text, page-by-page content and document dates from large batches of PDFs.
- **Operations and compliance teams** checking a list of PDFs for title, author, creation date, page count and encryption. Or finding the scans that still need text recognition.
- **Developers** who want a predictable, per-document PDF parsing step they can call from the API, Make, Zapier, n8n or an MCP client.

### What you get

One row per PDF, the same shape for every file:

| File | Status | Pages | Words | Tables | Links | Title | Created |
|---|---|---|---|---|---|---|---|
| fw9.pdf | ok | 6 | 6,301 | 0 | 0 | Form W-9 (Rev. March 2024) | 2024-03-06 |
| empsit.pdf | ok | 39 | 16,381 | 114 | 5 | The Employment Situation - October 2026 | 2026-11-03 |
| p60-279.pdf | ok | 62 | 36,229 | 75 | 72 | Income in the United States: 2022 | 2023-08-30 |

Tables are best-effort: large report tables can come back in a few pieces (see "How good is table detection?" below).

Every row also has:

- The author, subject and keywords.
- The creator and producer apps.
- The modified date, the PDF version and the declared language.
- Whether the file is encrypted.
- `hasTextLayer`, which is false for scans.
- How many pages had no text.
- The file size and the final address after redirects.
- A `status`, and an `error` with the next step when something went wrong.
- A `charged` flag, so you can see exactly what you paid for.

Full example item (real run, Nov 16, 2026; text, tables and links shortened here):

```json
{
  "url": "https://www.bls.gov/news.release/pdf/empsit.pdf",
  "source": "url",
  "fileName": "empsit.pdf",
  "fileSizeBytes": 576822,
  "status": "ok",
  "error": null,
  "pageCount": 39,
  "pagesProcessed": 39,
  "title": "The Employment Situation - October 2026",
  "producer": "Adobe Acrobat (64-bit) 26.2.22031",
  "createdAt": "2026-11-03T22:33:56.000Z",
  "modifiedAt": "2026-11-05T16:53:32.000Z",
  "encrypted": false,
  "hasTextLayer": true,
  "pagesWithoutText": 0,
  "wordCount": 16381,
  "text": "Transmission of material in this news release is embargoed until USDL-26-1632\n8:30 a.m. (ET) Friday, November 6, 2026\nTechnical information: ...",
  "tableCount": 114,
  "tables": [
    { "page": 5, "rowCount": 23, "columnCount": 5, "rows": [["Total nonfarm", "-140", "186", "60", "165"], ["Total private", "13", "142", "78", "159"]] }
  ],
  "linkCount": 5,
  "links": [{ "page": 6, "url": "https://www.bls.gov/web/empsit/cesbmart.htm" }],
  "charged": true,
  "extractedAt": "2026-11-16T05:49:27.540Z"
}
```

Turn on **Include text per page** to also get a `pages` list (page number, text, word count, and whether the page had text).

**Safe to open in Excel and Google Sheets:** some text starts with `=`, `+`, `-` or `@`. That text gets a leading apostrophe (`'`), so a spreadsheet shows it as text instead of running it as a formula. This covers the text, the PDF properties, file names and table cells. Plain numbers such as `-140` are left as they are.

#### Statuses

| status | Meaning | Charged? |
|---|---|---|
| `ok` | Text was extracted | Yes |
| `no-text-layer` | The PDF holds only images (usually a scan). Metadata and page count are still returned | **No** |
| `error` | The file could not be read: password-locked, damaged, not a PDF (for example a login page), too large, too slow, refused by robots.txt, not found, or not a valid link. `errorCode` and `error` say which, and what to do next | **No** |

### How to use it

1. **Add your PDFs** in any of three ways. Paste links into **PDF links** (one per line). Upload files with **Upload PDF files**. Or pick a **key-value store** that already holds PDFs (for example files saved by another Actor). Duplicates are removed for you.
2. **Choose what you need:** tables and links are on by default. Turn on **Include text per page** for the text of each page. Pick a **Text order**: natural reading order, or a top-to-bottom layout with a tab between table cells.
3. **Run it** and download the results as JSON, CSV or Excel, or send them to Google Sheets. For search indexes, use the `text` or `pages` fields directly.

No login or API key is needed for public PDFs. You only need your Apify account.

### Pricing

Pay per PDF: one charge for each PDF the Actor got text out of, no matter how many pages it has.

- **1,000 PDFs with text = $5.00** ($0.005 per PDF), plus Apify's small standard charge for starting a run. Send many PDFs per run rather than one run per PDF, so you pay that start charge once.
- **Free:** scans without a text layer, locked, damaged and oversized files, web pages posing as PDFs, robots.txt refusals and dead links. They are still in your results with the reason.
- **Why per PDF and not per page?** You know the price before you click Start. A 300-page annual report costs the same as a 2-page invoice. To keep this fair for everyone, each PDF is read up to **Max pages per PDF** (default 500, up to 5,000) and the row says so with `pagesTruncated` when a file is longer.
- **Hard limits:** a maximum number of charged PDFs, a run time limit, a time limit per PDF and a file size limit. You can also set a maximum cost per run in Apify. The Actor stops cleanly when it is reached. PDFs it did not get to are listed (not charged), so you can run them later.

### Scheduling & integrations

- **Schedules**: read a list of report links again every week or month to pick up new editions. The `modifiedAt` date shows when a file changed.
- **API**: start runs and fetch results with the Apify API or the JavaScript and Python clients.
- **Make, Zapier, n8n**: send PDF links from email attachments, forms or a CRM to this Actor, and write the text and metadata back.
- **Google Sheets**: export each run straight to a sheet.
- **MCP clients**: any tool that connects to Apify's MCP server can call this Actor to read PDFs by link.
- **Other Actors**: point **Key-value store with PDFs** at the store where a crawler saved its PDF files.

### Tested to the Gold Standard

Gold Standard Web built this Actor and tests it with [Gold Standard QA](https://goldstandardweb.com/qa), our three-layer quality process.

- Every change must pass the full test suite before it is saved.
- We plant bugs in the code on purpose, and the tests must catch at least 90% of them.
- A reviewer who did not write the code tries to break it before each release.

[See every check we run](https://goldstandardweb.com/qa).

### FAQ

**Is this legal to use?**
The Actor downloads only the PDF links you give it (it does not crawl other pages), the way your browser would: no login, no bot-check bypass, no proxies. It identifies itself honestly (`GoldStandardWeb-Apify/1.0`) and follows each site's robots.txt, including crawl-delay. Use it for documents you are allowed to read and process, such as public reports, your own files, or files you have rights to. The example input uses public US government documents (IRS and Bureau of Labor Statistics).

**What about scanned PDFs?**
A scan is a picture of a page, so there is no text to extract. The Actor detects this, returns the page count and metadata with `status: "no-text-layer"`, and does not charge for it. Text recognition (OCR) for scans is planned for a later version.

**How good is table detection?**
It is best-effort. The Actor finds tables from the position of the text: lines with several cells that line up in shared columns over at least 3 rows. It works well on clean report and statistical tables (like the BLS example above) and returns each table as rows and cells. It does not understand merged cells, tables drawn as images, or tables that span pages. A table with a header over several lines, or with section headings inside it (for example "Race" and "Age" blocks in a Census table), comes back as several smaller tables, with the header as its own table. A table of contents can come back as a 2- or 3-column table. Always check tables you rely on.

**Why does a link come back as "a web page (HTML), not a PDF"?**
Many "PDF links" open a viewer or a login page first. Open the link in your browser, then copy the address of the PDF file itself (it usually ends in `.pdf`). Dropbox share links are changed to their direct download automatically.

**Can it read Google Drive links?**
No. Google's robots.txt does not allow automated downloads of Drive files, and this Actor respects that. Download the file and use **Upload PDF files**, or host it at a direct link.

**Where do uploaded files go?**
**Upload PDF files** saves each file in a key-value store in your own Apify account. If your storage is private (the default for new Apify accounts), the Actor may only read stores you pick for it, so do this: in the upload window choose **New permanent storage** or **Existing storage**, then pick that same store under **Key-value store with PDFs**. Each file is read once and charged once, even when it is in both fields. If a run cannot read an upload, its row is free and names the store and the record key to pick.

**What about password-protected PDFs?**
PDFs that open without a password (even if they are encrypted against printing or copying) are read normally and flagged with `encrypted: true`. PDFs that need a password to open come back with `errorCode: "PASSWORD"`, free.

**What about Chinese, Japanese, Korean and other languages?**
The Actor ships the standard PDF character maps, so text in these languages is extracted when the PDF has a text layer. Word counts treat each run of CJK characters as one word.

**What happens with huge files?**
Files above **Max file size** (default 50 MB, up to 100 MB) are skipped for free. A PDF whose text is too large for one dataset row (about 8 MB) keeps a shortened `text` with `textTruncated: true`; the full text, pages and tables are saved in the run's key-value store under the key in `fullTextKey`. One compressed part of a PDF may expand to at most about 100 MB at the default 1 GB of memory; a file that goes past that (usually a damaged or hostile "zip bomb") stops with `errorCode: "TOO_COMPLEX"`, free. Give the run more memory if a real file needs more.

**What happens if the run hits my time limit or maximum cost?**
It stops starting new PDFs, finishes cleanly, and lists the PDFs it did not read in the log and in the run's key-value store (record `UNPROCESSED`). Those were not charged; run them again. If Apify moves the run to another server mid-run, it continues there and no PDF is charged twice.

### Limitations

- No OCR yet: scans and image-only pages return no text (free).
- Tables are best-effort (see the FAQ); form field values typed into fillable PDFs are not extracted.
- Text order: "natural" follows the order stored in the PDF. That is right for most files, including articles with several columns. Some PDFs store text out of order, and "layout" (top to bottom) can read those better.
- Up to 10,000 PDFs per run, 5,000 pages and 100 MB per PDF, 500 tables and 2,000 links per PDF. Links are web and email links only.
- Google Drive and pages that need a login cannot be read; upload those files instead.

### Input reference

| Field | Type | Default | Description |
|---|---|---|---|
| `pdfUrls` | array | - | PDF links, one per line (up to 10,000; duplicates removed). `startUrls` (`[{ "url": "..." }]`) is accepted too |
| `uploadedFiles` | array | - | Files uploaded in the input form (or more links) |
| `keyValueStoreId` | string | - | A key-value store in your account that holds PDFs |
| `keyValueStoreKeys` | array | all records | Only read these record keys of that store |
| `extractTables` | boolean | `true` | Detect tables (best-effort) |
| `extractLinks` | boolean | `true` | List web and email links with their page |
| `includePages` | boolean | `false` | Add per-page text in `pages` |
| `textLayout` | string | `natural` | `natural` (stored reading order) or `layout` (top to bottom, tab between cells) |
| `maxPagesPerDocument` | integer | `500` | Pages read per PDF (1-5,000) |
| `maxFileSizeMb` | integer | `50` | Skip larger files (1-100 MB) |
| `perFileTimeoutSeconds` | integer | `120` | Time limit per PDF (10-600 s) |
| `maxResults` | integer | `1000` | Stop after this many charged PDFs (up to 10,000) |
| `maxRunMinutes` | integer | `60` | Run time limit (1-600) |

At least one of `pdfUrls`, `uploadedFiles` or `keyValueStoreId` is needed.

### Output fields

- File: `url`, `source`, `fileName`, `finalUrl`, `fileSizeBytes`
- Result: `status`, `error`, `errorCode`, `charged`, `extractedAt`
- Pages: `pageCount`, `pagesProcessed`, `pagesTruncated`, `pagesWithoutText`, `hasTextLayer`
- PDF properties: `title`, `author`, `subject`, `keywords`, `creator`, `producer`
- More properties: `createdAt`, `modifiedAt`, `pdfVersion`, `language`, `encrypted`
- Text: `text`, `wordCount`, `charCount`, `textTruncated`, `fullTextKey`
- Tables and links: `tableCount`, `linkCount`, `tables` (optional), `links` (optional)
- Per page: `pages` (optional)

### How it works

For each link, the Actor reads the site's robots.txt and downloads the file. It follows up to 5 redirects and checks each one again. It checks that the file really is a PDF. Then it reads it with pdf.js, the open-source PDF engine used by Firefox. Each PDF is read in its own worker with a time limit and a memory cap. Every compressed part is cut off once it expands past half that cap. So a damaged or hostile file ends as an error row instead of stopping the run. PDF scripts (JavaScript) are never run. Uploaded files are read through the key-value store you pick, or by their link when your storage is public. Up to 3 PDFs are read at the same time, one download at a time per website (with the site's crawl-delay). Internal and private network addresses are refused, both as input and after redirects and DNS lookups. Files above the size limit are refused before they are downloaded when the server reports their size, and cut off while downloading when it does not.

# Actor input Schema

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

Direct links to PDF files, one per line (for example https://www.irs.gov/pub/irs-pdf/fw9.pdf). Dropbox share links work too. Each PDF gives one row. Google Drive links can't be read (Google's robots.txt forbids automated downloads of Drive files); upload those files instead.

## `uploadedFiles` (type: `array`):

Upload PDFs from your computer (or paste more links). If your Apify storage is private, the default for new accounts, upload into a permanent or existing store and also pick that store under "Key-value store with PDFs" so the Actor may read it.

## `keyValueStoreId` (type: `string`):

Read PDFs that are already stored in one of your key-value stores (for example files saved by another Actor). Leave empty if you only use links.

## `keyValueStoreKeys` (type: `array`):

Only read these records of the key-value store above. Leave empty to read every record (records that are not PDFs come back as free error rows).

## `extractTables` (type: `boolean`):

Find tables by the position of the text and return them as rows and cells. Best effort: works well on clean report tables, not on scans or merged-cell layouts.

## `extractLinks` (type: `boolean`):

List the clickable web and email links in each PDF, with their page numbers.

## `includePages` (type: `boolean`):

Add a "pages" list with the text and word count of every page, in addition to the full text.

## `textLayout` (type: `string`):

"Natural" keeps the order the PDF stores its text (best for multi-column articles). "Layout" rebuilds each line from top to bottom and left to right, with table cells separated by a tab (best for forms and reports).

## `maxPagesPerDocument` (type: `integer`):

Read at most this many pages of each PDF (up to 5,000). Longer files are marked with "pagesTruncated".

## `maxFileSizeMb` (type: `integer`):

Skip files larger than this (up to 100 MB). Skipped files are free and say so in the "error" column.

## `perFileTimeoutSeconds` (type: `integer`):

Stop reading a single PDF after this many seconds (10 to 600). A stopped file is free and says so in the "error" column.

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

Stop after this many PDFs with text (each one is a charged result). Errors and scans without text don't count and are free.

## `maxRunMinutes` (type: `integer`):

Stop starting new PDFs after this many minutes. PDFs not read are listed in the run's key-value store as "UNPROCESSED" and are not charged.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://www.bls.gov/news.release/pdf/empsit.pdf"
  ],
  "uploadedFiles": [],
  "keyValueStoreKeys": [],
  "extractTables": true,
  "extractLinks": true,
  "includePages": false,
  "textLayout": "natural",
  "maxPagesPerDocument": 500,
  "maxFileSizeMb": 50,
  "perFileTimeoutSeconds": 120,
  "maxResults": 1000,
  "maxRunMinutes": 60
}
```

# 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 = {
    "pdfUrls": [
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://www.bls.gov/news.release/pdf/empsit.pdf"
    ]
};

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

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

```

## MCP server setup

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