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

Turn PDF links into clean data: full text and page-by-page text, tables (ruled and number grids), links, emails and metadata (title, author, dates, page count). Page ranges, password PDFs, scanned-file detection. Pay only for PDFs with text; failures are free. No browser, no API key.

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

## Pricing

from $2.13 / 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, Tables & Metadata Extractor (from URLs)

Give it a list of PDF links and get back clean, structured data: the full text, the text of every page, tables as rows of cells, every link and email address in the document, and the file's metadata (title, author, creator, creation and modification dates, page count, size). One row per PDF, ready for JSON, CSV, Excel, a database, or an AI pipeline.

No browser, no proxy, no API key. Failed downloads, non-PDF links, oversized files and scanned (image-only) PDFs are returned as rows with an explanation and are **not charged**.

### What you can use it for

- **AI and RAG pipelines**: feed reports, manuals, filings and papers into embeddings or an LLM, with page numbers kept for citations
- **Research and monitoring**: pull the text of government reports, annual reports, white papers or academic papers on a schedule
- **Finance and data teams**: get the number grids out of statistical releases and financial statements as tables
- **Lead and contact research**: collect the emails and links printed in brochures, price lists and catalogs
- **Document audits**: check page counts, authors, producers and dates across thousands of files

### Why this one

- **Page-by-page text** with character counts, plus the full text in one field
- **Tables two ways**: ruled tables (with lines) and whitespace-aligned number grids, the kind used in statistical releases and financial statements
- **Page ranges** such as `1-3,7` or `-2` (the last two pages), so you only pay compute for what you need
- **Scanned-file detection**: a PDF with no text layer is flagged `likelyScanned: true` and is free, instead of returning an empty row you pay for
- **Password PDFs** supported, metadata dates normalized to ISO 8601
- **Pay only for PDFs that produced text**

### Input

| Field | What it does | Default |
|---|---|---|
| `pdfUrls` | Direct links to PDF files, one per line | required |
| `pages` | Page selection, e.g. `1-3,5` or `-2`; empty = all | all |
| `includePageText` | Adds the `pages` array (page number, text, characters) | true |
| `extractTables` | Detect tables and return them as rows of cells | false |
| `tableStrategy` | `auto` (ruled tables, then number grids), `lines`, or `text` | auto |
| `extractLinksAndEmails` | Collect hyperlinks and email addresses | true |
| `maxCharsPerPdf` | Truncate text per PDF (0 = no limit) | 0 |
| `maxFileSizeMb` | Skip larger files (free error row) | 40 |
| `password` | Password for protected PDFs | none |
| `maxResults` | Stop after this many PDFs | 1000 |

Example input:

```json
{
  "pdfUrls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf", "https://arxiv.org/pdf/1706.03762"],
  "pages": "1-3",
  "extractTables": true
}
```

### Output

One row per PDF:

| Field | Meaning |
|---|---|
| `url`, `finalUrl` | The link you gave and where it ended up after redirects |
| `ok`, `error`, `warning` | Whether the PDF was read; why not; a note such as "looks scanned" |
| `fileName`, `sizeBytes` | File name and size |
| `pageCount`, `pagesExtracted` | Pages in the file and pages read |
| `title`, `author`, `subject`, `keywords`, `creator`, `producer` | Document metadata |
| `createdAt`, `modifiedAt` | Metadata dates in ISO 8601 |
| `encrypted`, `likelyScanned` | Password-protected; no text layer |
| `text`, `wordCount`, `charCount` | Full text and its size |
| `pages` | `[{page, text, chars}]` |
| `tables` | `[{page, index, method, rows: [[cell, ...], ...]}]` |
| `links`, `emails` | Unique links and email addresses found |
| `processingSeconds` | Time spent on this file |

Sample (shortened):

```json
{
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "ok": true,
  "fileName": "fw9.pdf",
  "pageCount": 6,
  "pagesExtracted": 3,
  "title": "Form W-9 (Rev. March 2024)",
  "createdAt": "2024-03-06T08:18:13",
  "likelyScanned": false,
  "wordCount": 3595,
  "text": "W-9\nRequest for Taxpayer\nIdentification Number and Certification ...",
  "pages": [{"page": 1, "text": "W-9 ...", "chars": 5659}],
  "tables": [{"page": 1, "index": 0, "method": "lines", "rows": [["...", "..."]]}],
  "links": [],
  "emails": []
}
```

### How much does it cost?

Pay per result: **$2.50 per 1,000 PDFs extracted** on the Free plan (a small one-time start fee per run), with automatic discounts on paid Apify plans. Failed downloads, non-PDF links, oversized files and scanned PDFs without text are free.

Worked examples:

- **50 annual reports** for a research project: 50 × $0.0025 = **$0.13**
- **1,000 papers** for a RAG index: **$2.50**
- **10,000 manuals** with 300 that turn out to be scanned images: 9,700 × $0.0025 = **$24.25** (the 300 scanned files are free)

Platform compute is included in the price.

### FAQ

**Can it read scanned PDFs?** It detects them (`likelyScanned: true`, with a warning) and does not charge for them. It does not run OCR, so an image-only page returns little or no text.

**Why is a table split into odd cells?** Tables without ruling lines are rebuilt from the position of words on the page. Number columns come out reliably; long labels can be split across two cells. Use `tableStrategy: lines` for ruled tables only, or `text` to force the whitespace method on every page.

**Some links return "HTTP 403".** A few sites refuse automated downloads. Those rows are free. Download the file yourself and host it anywhere with a direct link, or use a link from a site that allows downloads.

**Is it legal?** It downloads the files you link to, the same way a browser does, and reads them. You are responsible for having the right to use the documents you process (public reports and documents you own are the usual case).

**How big can a PDF be?** Up to `maxFileSizeMb` (40 MB by default, 200 MB maximum). For very long documents, use `pages` to read only the part you need.

**Does it keep my files?** No. Files are processed in memory during the run and only the extracted data is written to your dataset.

### Integrations

Run it from the Apify API, a schedule, or any integration Apify supports: Make, Zapier, n8n, Google Sheets, webhooks, and AI agents through the Apify MCP server. The dataset downloads as JSON, CSV, Excel, XML or HTML.

### Changelog

- 0.1 (October 2026): first release: text, page text, tables (ruled and number grids), links, emails, metadata, page ranges, password PDFs, scanned-file detection.

# Actor input Schema

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

Direct links to PDF files, one per line (http or https). Redirects are followed.

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

Optional page selection, e.g. 1-3,5 or -2 (last two pages). Empty = all pages.

## `includePageText` (type: `boolean`):

Adds a `pages` array with each page's text and character count. Default: true.

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

Detect tables and return them as rows of cells. Default: false (it is slower).

## `tableStrategy` (type: `string`):

How tables are found. Auto finds ruled tables and falls back to number grids aligned by whitespace (financial statements, statistics).

## `extractLinksAndEmails` (type: `boolean`):

Collect hyperlinks (clickable and written-out) and email addresses found in the text. Default: true.

## `maxCharsPerPdf` (type: `integer`):

Truncate the text (and each page's text) to this many characters. 0 = no limit.

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

Larger files are skipped with an error row (not charged). Default: 40.

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

Only for password-protected PDFs (the same password is tried on every file).

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

Stop after this many PDFs. Default: 1000.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://arxiv.org/pdf/1706.03762"
  ],
  "includePageText": true,
  "extractTables": false,
  "tableStrategy": "auto",
  "extractLinksAndEmails": true,
  "maxCharsPerPdf": 0,
  "maxFileSizeMb": 40,
  "maxResults": 1000
}
```

# Actor output Schema

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

All results as JSON items in the run's default dataset (also downloadable as CSV/Excel from the dataset).

# 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://arxiv.org/pdf/1706.03762"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("larkmoor/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://arxiv.org/pdf/1706.03762",
    ] }

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

```

## MCP server setup

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