# PDF to Markdown & Text Extractor (Bulk, Pages & Metadata) (`pagecraft/pdf-text-extractor`) Actor

Turn any list of PDF URLs into clean Markdown and text: headings, lists and paragraphs for LLMs and RAG, plus text per page, page count, title, author and dates. Scans flagged. Pay per PDF.

- **URL**: https://apify.com/pagecraft/pdf-text-extractor.md
- **Developed by:** [Pagecraft Tools](https://apify.com/pagecraft) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 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 to Markdown & Text: Bulk PDF Text Extractor with Pages and Metadata

**For** AI builders, researchers and analysts turning PDFs into Markdown or text. **You get** Markdown and plain text for each PDF (and each page), with title, author, dates, page and word counts.

**Real run (12 Nov 2026, the example input):** 2 PDFs, including the 6-page IRS Form W-9 (6,278 words), in 3 seconds. **The example input costs under 1 cent** on Apify's Free plan; the plan's $5 of free monthly usage covers about 1,250 PDFs. Try it in one click with the ready-made task [Convert PDF reports to Markdown for AI and RAG](https://apify.com/pagecraft/pdf-text-extractor/examples/convert-pdf-reports-to-markdown-for-ai-and-rag).

| file | pages | title | words |
| --- | --- | --- | --- |
| dummy.pdf | 1 | (none) | 3 |
| fw9.pdf | 6 | Form W-9 (Rev. March 2024) | 6,278 |

Give it a list of **PDF links** and get back the **full text** and **clean Markdown** (headings, lists and paragraphs, ready for LLMs and RAG), optionally the **text of every page**, plus the **page count, title, author, subject, keywords and created and modified dates**. Reports, papers, contracts, manuals, invoices and government forms in bulk, with no uploads and no software to install. Scanned PDFs with no text layer are flagged so you know to OCR them.

![PDF to Markdown demo: a PDF link goes in, Markdown with headings and lists comes out](https://raw.githubusercontent.com/pagecraftAPI/pagecraft-mcp/main/media/pdf-to-markdown.gif)

### Quick start

1. Press **Try for free**. The form opens with a working example (`https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf`, `https://www.irs.gov/pub/irs-pdf/fw9.pdf`).
2. Replace it with your own PDF URLs.
3. Press **Start**. Results appear as they are found; download them as Excel, CSV or JSON, or use the API.

A result looks like this (some columns):

| url | fileName | fileSizeKb | pageCount | pagesExtracted |
| --- | --- | --- | --- | --- |
| https://files.example.com/report | annual-report-2025.pdf | 3 | 3 | 3 |

### What it does

- 📄 **Full text, line breaks kept**, read with Mozilla pdf.js (the PDF engine in Firefox).
- 📝 **PDF to Markdown**: larger text becomes `#` headings, bullets and numbered lines become lists, and lines that wrap are joined back into paragraphs. On by default.
- 📑 **Text per page** on request, for citing page numbers or chunking long documents for AI and RAG.
- 🏷️ **Metadata**: page count, title, author, subject, keywords, creator and producer apps, PDF version, language, and created and modified dates in ISO 8601.
- 🔍 **Scans flagged**: `hasTextLayer: false` and a note when a PDF is only images, instead of silent empty text.
- 🧮 **Word count**, file name and file size for every PDF.
- 🧹 **Clear failures**: missing files, login pages, password protected and broken PDFs each come back with a plain-English reason.

### Who it's for

- **AI and RAG builders** turning document libraries into clean text.
- **Analysts and researchers** pulling annual reports, filings and papers into spreadsheets.
- **Legal, procurement and compliance teams** searching contracts and tenders.
- **AI agents** through the Apify MCP server, Make, n8n and Zapier.

### Input

| Field | What to enter |
| --- | --- |
| PDF URLs | Direct links to PDF files, one per line |
| Markdown output | On by default; turn off for plain text only |
| Text per page | Optional, adds a `pages` list (with Markdown per page too) |
| Maximum pages per PDF | Optional, 0 = all pages |
| Maximum file size (MB) | Under Advanced, default 50 MB |

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

### Output

One row per PDF:

```json
{
  "url": "https://files.example.com/report",
  "fileName": "annual-report-2025.pdf",
  "fileSizeKb": 3,
  "pageCount": 3,
  "pagesExtracted": 3,
  "title": "Annual Report 2025",
  "author": "Northwind Ltd",
  "subject": "Results",
  "keywords": "report, results",
  "createdAt": "2026-11-08T08:20:00.000Z",
  "modifiedAt": "2026-11-08T08:20:00.000Z",
  "pdfVersion": "1.3",
  "hasTextLayer": true,
  "wordCount": 1278,
  "text": "Annual Report 2025 - page 1\nLine 1 of page 1: revenue grew 12% to GBP 4.2m while costs fell.\n...",
  "markdown": "# Annual Report 2025\n\n## Highlights\n\n- Revenue grew 12% to GBP 4.2m\n- Costs fell 3%\n...",
  "pages": [{ "page": 1, "text": "Annual Report 2025 - page 1\n...", "markdown": "# Annual Report 2025\n..." }],
  "textTruncated": false,
  "note": null,
  "error": null
}
```

`pages` is `null` unless you ask for text per page. Download the results as JSON, CSV or Excel, or read them through the API.

### Pricing

| Event | When it is charged | Price per 1,000 (Free / Bronze / Silver / Gold plan) |
| --- | --- | --- |
| PDF extracted | Each PDF whose text and metadata are returned (covers files up to 2 MB). | $4 / $3.50 / $3 / $2.50 |
| Extra MB | Each started MB above 2 MB in a downloaded PDF (very slow servers count 1 MB per 3 s beyond 20 s). | $1 / $0.90 / $0.75 / $0.60 |
| PDF failed | A file that could not be downloaded or read: not found, not a PDF, password protected (it still uses server time). | $2 on every plan |

Example: 1,000 PDFs of up to 2 MB each cost $4 on the Free plan. A 10 MB PDF costs the PDF fee plus 8 extra MB (under 1 cent more on the Free plan). Files that cannot be read are charged the smaller failed fee, because they still use server time and data.

### Notes and limits

- Markdown is rebuilt from the layout of the text: headings come from font size, so a PDF that uses bold body-size text for headings gets them as paragraphs. Tables keep their text but not their grid, and images are not included.

- Text comes from the PDF's own text layer. Scanned PDFs are flagged with `hasTextLayer: false`; use an OCR tool for those.

- Each file gets 20 seconds plus 3 seconds per extra MB, and two files are read at a time. Very slow servers are counted at 1 MB per 3 seconds beyond 20 seconds.

- Files behind a login, or links to a web page that shows the PDF, return a "did not return a PDF" reason. Use the direct file link.

- Password protected PDFs cannot be read.

### Use with AI agents (MCP)

Connect this tool to Claude, Cursor, VS Code or any other MCP client through the [Apify MCP server](https://mcp.apify.com/). To load only this tool, use this server URL:

```
https://mcp.apify.com?tools=pagecraft/pdf-text-extractor
```

Then ask, for example: "Convert these three annual report PDFs to Markdown, page by page". The agent gets back the Markdown and text (and both per page), page count, title, author and dates for each PDF. Each call is charged per event at the prices in Pricing above. Agents without an Apify account can also pay per run through [Apify's agentic payments](https://docs.apify.com/agents/payments).

### Workflows with other Pagecraft tools

Pagecraft tools are built to work together. Ideas that use this one:

**Turn documents and web pages into AI-ready text.** Feed a RAG system, a vector database or an LLM prompt with clean text.

1. [Sitemap URL Extractor](https://apify.com/pagecraft/sitemap-url-extractor): List every page URL of a website from its sitemaps.
2. [Article Extractor](https://apify.com/pagecraft/article-extractor): Get clean text or Markdown, with title, author and date, for each page.
3. **This tool**: Add the text of any PDF reports or papers, page by page.
4. [OCR Image to Text](https://apify.com/pagecraft/ocr-image-to-text): Read text from scans, screenshots and images the other steps cannot.

**Win public sector contracts.** Find UK tenders and read their documents quickly.

1. [UK Government Tenders Scraper](https://apify.com/pagecraft/uk-tenders-finder): New UK government tenders and contract notices by keyword.
2. **This tool**: The text of the tender documents, ready to search or summarise.

### More Pagecraft tools

- [Article Extractor](https://apify.com/pagecraft/article-extractor): clean text and Markdown from any article or blog URL.
- [UK Government Tenders](https://apify.com/pagecraft/uk-tenders-finder): contract notices whose documents are often PDFs.
- [Website Contact Extractor](https://apify.com/pagecraft/website-contact-extractor): emails, phones and social links from any website.

# Actor input Schema

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

Direct links to PDF files, one per line, e.g. https://www.example.com/annual-report.pdf. Up to 10,000 per run.

## `markdown` (type: `boolean`):

Also return the text as Markdown (on by default): larger text becomes headings, bullets and numbered lines become lists, and wrapped lines are joined into paragraphs. Ideal for LLMs, RAG and notes apps. Tables keep their text but not their grid.

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

Also return a pages list with the text of each page, for citing page numbers or chunking long documents.

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

Read only the first N pages of each PDF (0 = all pages).

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

Larger files are skipped with an explanation. Files over 2 MB also pay a small fee per extra MB (see Pricing).

## `proxyConfiguration` (type: `object`):

Not usually needed. Use Apify datacenter proxies for sites that block cloud servers.

## Actor input object example

```json
{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
  ],
  "markdown": true,
  "includePages": false,
  "maxPages": 0,
  "maxFileSizeMb": 50
}
```

# 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 = {
    "urls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pagecraft/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 = { "urls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("pagecraft/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 '{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
  ]
}' |
apify call pagecraft/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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