# PDF to Text & Markdown Extractor (Bulk, AI-Ready) (`pankajbhatia/pdf-text-extractor`) Actor

Extract text from PDFs in bulk: paste PDF links or a page that links to PDFs. Clean plain text or Markdown, per-page rows for RAG, metadata (title, page count, dates). Fast, no OCR needed for digital PDFs. Pay per page.

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

## Pricing

from $0.50 / 1,000 pdf pages

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 & Markdown Extractor (Bulk, AI-Ready)

**Extract the text from PDF files in bulk.** Paste PDF links, or a web page that links to PDFs (a reports, filings, manuals or downloads page), and get clean **plain text or Markdown** for every document, with metadata like title, page count and dates. Choose **one row per PDF** or **one row per page**, ready for spreadsheets, search, AI and RAG pipelines.

- **Bulk**: hundreds of PDFs per run, processed in parallel.
- **Find PDFs for you**: give it a web page and it extracts every linked PDF.
- **AI-ready output**: Markdown with headings, bullet lists and `<!-- page N -->` markers, or per-page rows for chunking and citations.
- **Clean text**: hyphenated line breaks re-joined, extra whitespace removed.
- **Metadata**: title, author, subject, keywords, creator app, created and modified dates, page count, file size.
- **Fair pricing**: pay per page extracted. Broken links, non-PDF files and scanned PDFs without text are **not charged**.

### Who is it for?

- **AI and RAG builders**: turn PDF libraries (papers, manuals, policies, reports) into text for embeddings and chatbots.
- **Researchers and analysts**: pull text from annual reports, government documents, academic papers and filings.
- **Legal, compliance and procurement**: search contracts, tenders and regulations at scale.
- **SEO and content teams**: audit and repurpose PDF content published on websites.

### How to use it

1. Paste **PDF URLs**, one per line, and/or **web pages that link to PDFs**.
2. Choose the **Output format** (text, Markdown or both) and whether you want **one row per page**.
3. Click **Start**, then download the results as JSON, CSV or Excel, or get them through the API.

### Input example

```json
{
  "pdfUrls": ["https://arxiv.org/pdf/1706.03762", "https://www.irs.gov/pub/irs-pdf/fw9.pdf"],
  "webPagesWithPdfLinks": ["https://www.irs.gov/forms-instructions"],
  "maxPdfsPerWebPage": 10,
  "outputFormat": "markdown",
  "splitByPage": false
}
```

### Output example

```json
{
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "fileName": "fw9.pdf",
  "pageCount": 6,
  "pagesExtracted": 6,
  "fileSizeBytes": 140815,
  "metaTitle": "Form W-9 (Rev. March 2024)",
  "metaAuthor": "SE:W:CAR:MP",
  "metaSubject": "Request for Taxpayer Identification Number and Certification",
  "metaCreatedAt": "2024-03-06T08:18:13Z",
  "isScannedOrImageOnly": false,
  "charCount": 37677,
  "wordCount": 6272,
  "text": "Form W-9\n(Rev. March 2024)\nRequest for Taxpayer\nIdentification Number and Certification..."
}
```

With **One row per page** on, each row also has `pageNumber` and that page's `text` and/or `markdown`.

### How much does it cost?

Pay-per-event: a small fee **per PDF page extracted** plus a tiny per-run start fee, with no subscription and no separate platform usage costs. For example, 1,000 pages cost about $0.50. Failed downloads, non-PDF links and scanned PDFs with no text layer are **not charged**. Set **Maximum cost per run** to cap your spending. If the cap is reached mid-document, the output is cut at that point and you are never charged above it.

### Limits

- **Scanned PDFs** (photos of paper) have no text layer and need OCR. They are detected, marked `isScannedOrImageOnly: true` and not charged.
- Complex tables come out as text lines, not spreadsheet cells.
- Only public PDFs. Links that need a login can't be downloaded.

### Use it through the API, integrations or AI agents

Run it from the Apify API, schedules, Make, Zapier or n8n, or call it from AI agents through the Apify MCP server. Pair it with LangChain or LlamaIndex loaders to feed the text straight into vector databases.

### FAQ

**Is the text extraction accurate?** For digital PDFs (made by Word, Google Docs, LaTeX, reporting tools) the text is extracted exactly as stored in the file, in reading order.

**Can it open password-protected PDFs?** Yes, if you set the **PDF password** field.

**Found a bug or need a feature?** Open an issue. We usually reply within 24 hours.

### More tools from this developer

- [SAM.gov Contract Opportunities Finder & Bid Alerts](https://apify.com/pankajbhatia/sam-gov-contract-opportunities): federal contract opportunities and bid alerts
- [Sitemap & URL Extractor](https://apify.com/pankajbhatia/sitemap-url-extractor): get every URL of a website from its sitemaps
- [Website to Markdown for AI & RAG](https://apify.com/pankajbhatia/website-to-markdown): turn web pages into clean Markdown for LLMs
- [Tech Stack Detector](https://apify.com/pankajbhatia/tech-stack-detector): find what any website is built with
- [Apple App Store Reviews Scraper](https://apify.com/pankajbhatia/app-store-reviews): App Store reviews and ratings for any app
- [ATS Jobs Scraper](https://apify.com/pankajbhatia/ats-jobs-scraper): jobs from Greenhouse, Lever, Ashby, Workable and more
- [Website Screenshot](https://apify.com/pankajbhatia/website-screenshot): full-page, mobile and PDF screenshots in bulk
- [Domain WHOIS, DNS & SSL Checker](https://apify.com/pankajbhatia/domain-whois-dns-ssl-checker): bulk domain, DNS, email security and SSL checks
- [SEO Meta Tags & On-Page Audit](https://apify.com/pankajbhatia/seo-meta-tags-checker): bulk on-page SEO audit with fixes
- [Bulk URL Status & Broken Link Checker](https://apify.com/pankajbhatia/url-status-broken-link-checker): status codes, redirect chains and broken links
- [RSS & Atom Feed Reader](https://apify.com/pankajbhatia/rss-feed-reader): merge and filter many news feeds
- [Hacker News Scraper](https://apify.com/pankajbhatia/hacker-news-scraper): HN stories, comments and Who is hiring jobs
- [Academic Paper Search](https://apify.com/pankajbhatia/academic-paper-search): papers from Crossref, arXiv and PubMed
- [SEC EDGAR Filings & Financials](https://apify.com/pankajbhatia/sec-edgar-filings-financials): 10-K, 10-Q, 8-K filings and company financials

# Actor input Schema

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

Direct links to PDF files, one per line.

## `webPagesWithPdfLinks` (type: `array`):

Pages to search for PDF links (e.g. a reports, filings or downloads page). Every linked PDF is extracted.

## `maxPdfsPerWebPage` (type: `integer`):

Limit how many linked PDFs are taken from each web page.

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

Plain text, Markdown (headings and bullet lists, page markers; good for AI/RAG), or both.

## `splitByPage` (type: `boolean`):

Return each PDF page as its own row (great for chunking, search and citations) instead of one row per PDF.

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

Only extract the first N pages of each PDF. 0 = all pages.

## `pdfPassword` (type: `string`):

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

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

Skip PDFs larger than this.

## `maxConcurrency` (type: `integer`):

How many PDFs to process in parallel.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://arxiv.org/pdf/1706.03762",
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
  ],
  "maxPdfsPerWebPage": 20,
  "outputFormat": "text",
  "splitByPage": false,
  "maxPagesPerPdf": 300,
  "maxFileSizeMb": 50,
  "maxConcurrency": 4
}
```

# Actor output Schema

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

One item per PDF (or per page) with text, Markdown and metadata.

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

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

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

```

## MCP server setup

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