# PDF to Markdown & Clean Text Extractor (RAG Ready + MCP) (`forgekit/pdf-to-markdown-text-extractor`) Actor

Extract clean structured Markdown, two-column reading order, clickable hyperlinks, TOC bookmarks, metadata, and RAG chunks from PDFs with cloud-link auto-rewriting and Standby MCP.

- **URL**: https://apify.com/forgekit/pdf-to-markdown-text-extractor.md
- **Developed by:** [James Edmans](https://apify.com/forgekit) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.80 / 1,000 pdfs parsed successfully

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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-Markdown, Clean Text & Metadata Extractor (LLM & RAG Ready + MCP)

> **Apify Store Actor:** `forgekit/pdf-to-markdown-text-extractor` | **Runtime:** Node.js 22 (`pdfjs-dist` + `pdf-lib` + optional local `tesseract.js` OCR) | **Billing:** Pay-Per-Event (PPE) + Standby MCP Server

### Overview

**PDF-to-Markdown, Clean Text & Metadata Extractor** converts PDF files from public URLs, Google Drive / Dropbox / OneDrive share links, inline Base64 payloads, Apify Key-Value Stores, or upstream Apify Datasets into clean, structured Markdown, plain text, normalized metadata, clickable hyperlink inventories, Table-of-Contents bookmarks, and overlapping RAG chunks.

Because all parsing runs locally inside a deterministic Node.js container using `pdfjs-dist` with zero third-party scraping or external CAPTCHA-gated services, it operates with near-100% reliability at a fraction of the cost of cloud document APIs. It is designed specifically for LLM ingestion pipelines, vector databases, enterprise knowledge bases, and AI agents connecting over Apify's native Standby Model Context Protocol (MCP) server.

### Feature Comparison vs. Top Competitors

- **Automatic Cloud-Share Link Rewriting (`normalizeCloudPdfUrl`):** Automatically rewrites public Google Drive (`/file/d/<ID>/view`), Dropbox (`?dl=0` -> `?dl=1`), and OneDrive share URLs into direct binary downloads instead of failing on HTML viewer pages.
- **`%PDF-` Magic-Byte Guard & Zero-Charge Error Reporting:** Inspects file signatures before parsing; HTML login walls or viewer pages emit an actionable `errorCode: "HTML_INSTEAD_OF_PDF"` without crashing the batch and with **zero** `pdf-processed` or `page-extracted` charges.
- **Font-Size & Two-Column Reading-Order Reconstruction:** Computes document body font size and X-axis gutter occupancy to reconstruct `# H1` / `## H2` / `### H3` headings, bulleted/numbered lists, left-before-right two-column reading order, and clickable `[anchor](https://...)` Markdown hyperlinks.
- **Boilerplate & Page-Number Stripping:** Detects and removes repeated running headers/footers appearing across `>= 60%` of pages plus standalone `"Page X of Y"` counters.
- **Scanned Page & CID Glyph Corruption Detection:** Flags low-text pages (`isLikelyScanned: true`), missing font ToUnicode/CID mappings (`hasCidGlyphIssues: true`), and supports optional local `tesseract.js` OCR fallback.
- **Native Standby MCP Server:** Exposes `extract_pdf_markdown` and `extract_pdf_metadata` over JSON-RPC 2.0 / SSE for Claude Desktop, Cursor, and autonomous agents.

| Capability | PDF-to-Markdown Extractor (Ours) | `memo23/pdf-text-extractor` | `automation-lab/pdf-text-extractor` | `gochujang/pdf-text-extractor` |
|---|---|---|---|---|
| Structured Markdown + Headings + Links | Yes (`# H1`, lists, `[text](url)`) | Partial (no link preservation) | Plain text only | Partial |
| Two-Column Reading-Order Detection | Yes (X-gutter histogram) | No | No | No |
| Cloud Link Rewriter (Drive/Dropbox/OneDrive) | Yes (`normalizeCloudPdfUrl`) | No | No | No |
| `%PDF-` HTML Guard & CID Detection | Yes (`HTML_INSTEAD_OF_PDF`, `hasCidGlyphIssues`) | No | No | No |
| TOC Outline Bookmarks & RAG Chunker | Yes (native outline + overlapping chunks) | No | No | No |
| Standby MCP Server | Native (`/mcp` — 2 tools) | No | No | No |
| Per-PDF / Per-Page Pricing (FREE) | `$0.002` start + `$0.004/pdf` + `$0.0005/page` | `$0.005` start + `$0.005/pdf` | `$0.005` start + `$0.003/pdf` | `$0.001` start + `$0.005/pdf` + `$0.001/page` |

### Input Configuration

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `urls` | `string[]` | No\* | `[]` | Public PDF URLs (SSRF-protected, up to 500). |
| `normalizeCloudPdfUrl` | `boolean` | No | `true` | Auto-rewrite Google Drive, Dropbox, and OneDrive share links to direct PDF downloads. |
| `base64Pdfs` | `object[]` | No\* | `[]` | Inline PDF payloads `[{ "filename": "doc.pdf", "dataBase64": "..." }]` (up to 50). |
| `kvsKeys` | `string[]` | No\* | `[]` | Key-Value Store record keys containing binary PDFs (up to 200). |
| `sourceKeyValueStoreId` | `string` | No | `""` | Optional external Apify KVS ID for `kvsKeys`. |
| `inputDatasetId` | `string` | No\* | `""` | Upstream Apify Dataset ID to pull PDF URLs from. |
| `datasetUrlField` | `string` | No | `"url"` | URL field name in `inputDatasetId`. |
| `password` | `string` | No | `""` | Optional secret password for encrypted PDFs (`isSecret: true`). |
| `pageRange` | `string` | No | `""` | 1-indexed page selection (e.g. `"1-5,8,10-12"`). Empty = all pages up to `maxPages`. |
| `maxPages` | `integer` | No | `250` | Safety cap on extracted pages per PDF (`1–2000`). |
| `includeMarkdown` | `boolean` | No | `true` | Include reconstructed Markdown output. |
| `includeFullText` | `boolean` | No | `true` | Include plain full-text concatenation. |
| `includePerPageText` | `boolean` | No | `true` | Include `pages[]` array with per-page metrics. |
| `extractLinksAndOutline` | `boolean` | No | `true` | Extract PDF outline bookmarks and embedded URL annotations. |
| `removeHeadersFooters` | `boolean` | No | `true` | Strip repeated top/bottom margin lines matching `>= 60%` of pages. |
| `removePageNumbers` | `boolean` | No | `true` | Strip standalone margin page counters. |
| `preserveColumnOrder` | `boolean` | No | `true` | Detect two-column vertical gutters and read left column before right column. |
| `minTextCharsPerPage` | `integer` | No | `25` | Minimum non-whitespace characters below which a page is flagged `isLikelyScanned`. |
| `ocrScannedPages` | `boolean` | No | `false` | Optionally run local `tesseract.js` OCR on embedded images of scanned pages. |
| `chunkForRag` | `boolean` | No | `false` | Emit overlapping `chunks[]` ready for vector embeddings. |
| `chunkSizeChars` | `integer` | No | `1500` | Maximum characters per RAG chunk (`200–16000`). |
| `chunkOverlapChars` | `integer` | No | `200` | Overlap characters between adjacent chunks (`0–4000`, `< chunkSizeChars`). |
| `maxConcurrency` | `integer` | No | `5` | Concurrent PDF workers (`1–20`). |
| `maxPdfSizeMb` | `number` | No | `30` | Maximum download/base64 size per PDF in MB (`1–150`). |
| `timeoutSecs` | `integer` | No | `30` | Download and parse timeout per PDF in seconds (`5–180`). |

*\*At least one input source (`urls`, `base64Pdfs`, `kvsKeys`, or `inputDatasetId`) is required.*

### Output Example

Below is an exact output record captured from a local run of this Actor:

```json
{
  "source": "https://example.com/annual-report-2026.pdf",
  "filename": "annual-report-2026.pdf",
  "status": "ok",
  "pageCount": 1,
  "pagesExtracted": 1,
  "isLikelyScanned": false,
  "hasCidGlyphIssues": false,
  "scannedPageNumbers": [],
  "wordCount": 27,
  "charCount": 202,
  "metadata": {
    "title": "Annual Engineering Report 2026",
    "author": "Acme Analytics Ltd",
    "subject": null,
    "keywords": null,
    "creator": "LaTeX / PDF Builder",
    "producer": "pdf-lib (https://github.com/Hopding/pdf-lib)",
    "creationDate": "2026-12-01T20:44:14.000Z",
    "modificationDate": "2026-12-01T20:44:14.000Z",
    "pdfVersion": "1.7",
    "pageCount": 1,
    "isEncrypted": false,
    "isLikelyScanned": false
  },
  "outline": [],
  "links": [
    {
      "pageNumber": 1,
      "url": "https://docs.acme.example/benchmarks",
      "anchorText": "See benchmarks at docs.acme.example"
    }
  ],
  "markdown": "# Annual Engineering Report 2026\n\n## Executive Summary\n\nDistributed processing achieved 99.98% uptime across all clusters in 2026.\n\n- Reduced cold-start latency by 44 percent\n\n[See benchmarks at docs.acme.example](https://docs.acme.example/benchmarks)",
  "fullText": "Annual Engineering Report 2026\nExecutive Summary\nDistributed processing achieved 99.98% uptime across all clusters in 2026.\n• Reduced cold-start latency by 44 percent\nSee benchmarks at docs.acme.example",
  "pages": [
    {
      "pageNumber": 1,
      "text": "Annual Engineering Report 2026\nExecutive Summary\nDistributed processing achieved 99.98% uptime across all clusters in 2026.\n• Reduced cold-start latency by 44 percent\nSee benchmarks at docs.acme.example",
      "markdown": "# Annual Engineering Report 2026\n\n## Executive Summary\n\nDistributed processing achieved 99.98% uptime across all clusters in 2026.\n\n- Reduced cold-start latency by 44 percent\n\n[See benchmarks at docs.acme.example](https://docs.acme.example/benchmarks)",
      "wordCount": 27,
      "charCount": 202,
      "isLikelyScanned": false,
      "hasCidGlyphIssues": false
    }
  ],
  "chunks": [
    {
      "index": 0,
      "text": "# Annual Engineering Report 2026\n\n## Executive Summary\n\nDistributed processing achieved 99.98% uptime across all clusters in 2026.\n\n- Reduced cold-start latency by 44 percent\n\n[See benchmarks at docs.acme.example](https://docs.acme.example/benchmarks)",
      "charCount": 251,
      "pageStart": 1,
      "pageEnd": 1
    }
  ],
  "errorCode": null,
  "error": null
}
```

### Pay-Per-Event (PPE) Pricing

| Event Key | Event Title | Price (USD) | Billing Trigger |
|---|---|---:|---|
| `actor-start` | Actor run start | `$0.002` | Charged once per batch run that extracts at least one valid PDF (never charged on zero-success runs). |
| `pdf-processed` | PDF parsed successfully | `$0.004` | Charged once per valid PDF successfully extracted (never charged on HTML pages, 404s, or corrupt files). |
| `page-extracted` | PDF page extracted | `$0.0005` | Charged per page extracted from a valid PDF. |
| `mcp-tool-call` | Standby MCP tool execution | `$0.004` | Charged per successful Standby MCP tool call. |

**Illustrative Cost Example:** Extracting `100` five-page PDFs (500 pages total) costs `$0.002 + (100 * $0.004) + (500 * $0.0005) = $0.652 USD`.

### Standby MCP Server & AI Agent Integration

Enable Apify Standby Mode (`APIFY_META_ORIGIN=STANDBY`) to connect `forgekit/pdf-to-markdown-text-extractor` directly to Claude Desktop, Cursor, or any Model Context Protocol (MCP) client over Streamable HTTP / SSE:

- **Health endpoint:** `GET /health`
- **MCP JSON-RPC 2.0 & SSE endpoint:** `POST /mcp` and `GET /mcp`
- **Exposed MCP tools:**
  - `extract_pdf_markdown` — Full Markdown, plain text, per-page breakdown, outline, links, metadata, and optional RAG chunks from a PDF URL or base64 payload.
  - `extract_pdf_metadata` — Fast low-cost metadata, TOC bookmarks, page count, encryption status, and scanned-page detection.

```json
{
  "mcpServers": {
    "pdf-to-markdown-text-extractor": {
      "url": "https://forgekit--pdf-to-markdown-text-extractor.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

### Error Handling, Rate Limits & Limitations

- **SSRF Protection:** All URL downloads enforce strict `http:`/`https:` scheme rules and block private, loopback, RFC1918, and cloud metadata IPs across redirects.
- **Partial Batch Resilience:** Failed downloads, HTML viewer links (`HTML_INSTEAD_OF_PDF`), invalid headers (`INVALID_PDF_HEADER`), and corrupt PDFs emit structured `status: "error"` records without aborting sibling PDFs or incurring billable per-PDF charges.
- **Progress Visibility & Summary:** Every PDF logs `[PDF i/N] filename: extracted P pages (W words)` and persists `SUMMARY`, `RUN_SUMMARY`, and `PPE_LEDGER` records in the default Key-Value Store.
- **Scanned PDFs:** For heavy multi-page image-only PDFs requiring deep multi-language OCR and word bounding boxes, pair with our dedicated **Bulk Image & Scanned-PDF OCR Engine** Actor.

### Quick Start & Example Input

#### 1. Run in Apify Console (No Code)

1. Open **[`forgekit/pdf-to-markdown-text-extractor`](https://apify.com/forgekit/pdf-to-markdown-text-extractor)** in Apify Console and click **Try for free**.
2. Paste or adjust the ready-to-run input JSON below (safe defaults are pre-filled).
3. Click **Start** and export results as **JSON, CSV, Excel, or NDJSON** from the **Output** tab.

```json
{
  "urls": [],
  "normalizeCloudPdfUrl": true,
  "base64Pdfs": [],
  "kvsKeys": []
}
```

#### 2. Run via API (`apify-client` — Node.js & Python)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('forgekit/pdf-to-markdown-text-extractor').call({"urls":[],"normalizeCloudPdfUrl":true,"base64Pdfs":[],"kvsKeys":[]});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

```python
from apify_client import ApifyClient
import os

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("forgekit/pdf-to-markdown-text-extractor").call(run_input={"urls":[],"normalizeCloudPdfUrl":True,"base64Pdfs":[],"kvsKeys":[]})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(items)
```

#### 3. Connect to n8n, Make, Zapier & Webhooks

- **n8n / Make / Zapier:** Add the official **Apify** module, choose **Run Actor**, select `forgekit/pdf-to-markdown-text-extractor`, and pass the JSON payload above.
- **Schedules & Webhooks:** Attach an Apify Schedule for recurring runs and trigger downstream webhooks automatically on `ACTOR.RUN.SUCCEEDED`.

### Use Cases — What Can You Do With This Data?

- **Document & Invoice Ingestion Pipelines:** Automate PDF, OCR, table, or media extraction with **PDF-to-Markdown, Clean Text & Metadata Extractor (LLM & RAG Ready + MCP)** to feed accounting systems, ERPs, legal archives, and AI knowledge bases.
- **E-Commerce & Content Operations:** Process product images, generate pixel-perfect PDFs/screenshots, transcode media, or create/decode barcodes at scale via API without managing local FFmpeg or Chromium servers.
- **AI Vision & Multimodal Agent Workflows:** Convert raw PDFs, videos, podcasts, or webpages into clean Markdown, keyframes, transcripts, or optimized thumbnails ready for multimodal LLMs.
- **Automated QA & Visual Monitoring:** Schedule recurring captures or document checks and export structured metadata + KV Store artifacts directly into Slack, S3, Make, or n8n.

### Frequently Asked Questions (FAQ)

#### How much does PDF-to-Markdown, Clean Text & Metadata Extractor (LLM & RAG Ready + MCP) cost to run?

You only pay for actual output via transparent Pay-Per-Event billing (starting at `$0.004` per `pdf-processed` (PDF parsed successfully); see the PPE Pricing table above). Runs that produce zero billable results or fail upstream incur **`$0.00`** — including zero `actor-start` fee — and Apify's built-in **Max total charge** (`ACTOR_MAX_TOTAL_CHARGE_USD`) hard-caps spend automatically.

#### Does this Actor require proxies, logins, or CAPTCHA solving?

No. This Actor executes deterministic document/media processing locally inside the Apify container (Node.js 22, Sharp, PDF engines, FFmpeg, or Chromium where required) on files and URLs you supply, with strict SSRF protection blocking private/metadata IP ranges.

#### What export formats and integrations are supported?

Every run stores structured results in an Apify Dataset downloadable as **JSON, CSV, Excel (XLSX), NDJSON, XML, or HTML Table** via Console or REST API, plus native connectors for **n8n, Make, Zapier, Google Sheets, Airtable, Slack, and webhooks**.

#### Can AI agents (Claude Desktop, Cursor, ChatGPT, LangChain) call this Actor directly via MCP?

Yes! **PDF-to-Markdown, Clean Text & Metadata Extractor (LLM & RAG Ready + MCP)** includes a built-in **Standby MCP Server** at `https://forgekit--pdf-to-markdown-text-extractor.apify.actor/mcp` supporting JSON-RPC 2.0 (`initialize`, `ping`, `tools/list`, `tools/call`) with Claude-compliant `^[a-zA-Z0-9_.-]{1,64}$` tool schemas.

#### Do I need to provide an API key (`password`)?

All sensitive key fields (`password`) are optional BYOK upgrades marked `isSecret: true` — they are encrypted at rest by Apify and never echoed into datasets, KV summaries, or logs.

#### How fast and lightweight is it compared to browser scrapers?

It runs on lightweight **Node.js 22** (256–512 MB RAM, zero headless browser) so typical runs finish in seconds with high reliability and low platform compute cost.

### Related `forgekit` Actors

Explore companion Actors in **Media, Document & PDF Processing** and core ETL utilities to chain end-to-end pipelines:

| Actor | Store Slug | Mode |
|---|---|---|
| [PDF Structured Table & Invoice/Statement Extractor (JSON, CSV, XLSX + MCP)](https://apify.com/forgekit/pdf-table-invoice-extractor) | `forgekit/pdf-table-invoice-extractor` | ✅ Standby MCP |
| [PDF Toolkit: Bulk Merge, Split, Compress, Watermark, Rotate & Form Reader](https://apify.com/forgekit/pdf-toolkit-merge-split-watermark) | `forgekit/pdf-toolkit-merge-split-watermark` | Batch REST API |
| [Bulk Image & Scanned-PDF OCR Engine (Multi-Language + Word Bounding Boxes + MCP)](https://apify.com/forgekit/bulk-image-pdf-ocr-engine) | `forgekit/bulk-image-pdf-ocr-engine` | ✅ Standby MCP |
| [HTML, Markdown & URL to Pixel-Perfect PDF & Invoice Renderer](https://apify.com/forgekit/html-markdown-url-to-pdf-renderer) | `forgekit/html-markdown-url-to-pdf-renderer` | Batch REST API |
| [Multi-Device Website Screenshot API (Desktop/Tablet/Mobile Matrix, Dark Mode, Visual Diff + MCP)](https://apify.com/forgekit/multi-device-website-screenshot-api) | `forgekit/multi-device-website-screenshot-api` | ✅ Standby MCP |
| [Dataset Merge, Fuzzy Dedupe & Cross-Join Pro](https://apify.com/forgekit/dataset-merge-dedupe-pro) | `forgekit/dataset-merge-dedupe-pro` | ✅ Standby MCP |
| [Dataset Diff & Change Detector (Added / Removed / Modified)](https://apify.com/forgekit/dataset-diff-change-detector) | `forgekit/dataset-diff-change-detector` | ✅ Standby MCP |

# Actor input Schema

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

Public PDF URLs to download and parse (SSRF-protected). Supports Google Drive, Dropbox, and OneDrive share links when normalizeCloudPdfUrl is enabled.

## `normalizeCloudPdfUrl` (type: `boolean`):

Automatically convert public Google Drive, Dropbox (dl=0 to dl=1), and OneDrive share links into direct binary PDF download URLs.

## `base64Pdfs` (type: `array`):

Inline PDF payloads as objects \[{ "filename": "report.pdf", "dataBase64": "JVBERi0x..." }] for zero-URL offline and MCP workflows.

## `kvsKeys` (type: `array`):

Keys of binary PDF records stored in the Actor's Key-Value Store (or sourceStoreId).

## `sourceStoreId` (type: `string`):

Optional external Apify Key-Value Store ID to read kvsKeys from (defaults to the run's default store).

## `inputDatasetId` (type: `string`):

Optional Apify Dataset ID from which to read PDF URLs.

## `datasetUrlField` (type: `string`):

Field name containing the PDF URL inside each row of inputDatasetId.

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

Optional decryption password for encrypted PDF files.

## `pageRange` (type: `string`):

1-indexed page selection such as "1-5,8,10-12". Leave empty to extract all pages up to maxPages.

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

Safety upper cap on pages extracted per PDF.

## `includeMarkdown` (type: `boolean`):

Reconstruct headings, lists, and clickable links in clean Markdown.

## `includeFullText` (type: `boolean`):

Include clean plain-text concatenation across extracted pages.

## `includePerPageText` (type: `boolean`):

Include per-page text, Markdown, word counts, and scanned-page flags.

## `extractLinksAndOutline` (type: `boolean`):

Extract native PDF outline/bookmark tree and embedded hyperlink annotations.

## `removeHeadersFooters` (type: `boolean`):

Detect and strip repeated running top/bottom margin lines appearing on >= 60% of pages.

## `removePageNumbers` (type: `boolean`):

Remove standalone margin page counters such as "Page 3 of 10" or "- 3 -".

## `preserveColumnOrder` (type: `boolean`):

Detect vertical two-column gutters and order left column before right column.

## `minTextCharsPerPage` (type: `integer`):

Pages with fewer non-whitespace characters than this threshold are flagged as likely scanned.

## `ocrScannedPages` (type: `boolean`):

Optionally run local tesseract.js OCR on embedded images of scanned pages.

## `chunkForRag` (type: `boolean`):

Emit overlapping text chunks sized by chunkSizeChars and chunkOverlapChars.

## `chunkSizeChars` (type: `integer`):

Target maximum character length per RAG chunk.

## `chunkOverlapChars` (type: `integer`):

Overlap in characters between consecutive RAG chunks.

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

Maximum number of PDF files processed concurrently.

## `maxPdfSizeMb` (type: `number`):

Maximum allowed file size per PDF download or base64 payload in megabytes.

## `timeoutSecs` (type: `integer`):

Timeout in seconds for downloading and parsing each PDF.

## Actor input object example

```json
{
  "urls": [],
  "normalizeCloudPdfUrl": true,
  "base64Pdfs": [
    {
      "filename": "forgekit-sample-report.pdf",
      "dataBase64": "JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggMzA0ID4+CnN0cmVhbQpCVAovRjEgMTIgVGYKMSAwIDAgMSA3MiA3MjAgVG0gKEZvcmdlS2l0IFF1YXJ0ZXJseSBBdXRvbWF0aW9uIFJlcG9ydCkgVGoKMSAwIDAgMSA3MiA2OTAgVG0gKEV4ZWN1dGl2ZSBTdW1tYXJ5KSBUagoxIDAgMCAxIDcyIDY2NiBUbSAoUmV2ZW51ZSBncmV3IDQyIHBlcmNlbnQgeWVhciBvdmVyIHllYXIgYWNyb3NzIGVudGVycHJpc2UgQVBJIGFjY291bnRzLikgVGoKMSAwIDAgMSA3MiA2NDIgVG0gKEFsbCA4NSBjbG91ZCBwaXBlbGluZXMgbWFpbnRhaW5lZCA5OS45IHBlcmNlbnQgdXB0aW1lIGR1cmluZyBRNCAyMDI2LikgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagp4cmVmCjAgNgowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDAwMDkgMDAwMDAgbiAKMDAwMDAwMDA1OCAwMDAwMCBuIAowMDAwMDAwMTE1IDAwMDAwIG4gCjAwMDAwMDAyNDEgMDAwMDAgbiAKMDAwMDAwMDMxMSAwMDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDYgL1Jvb3QgMSAwIFIgPj4Kc3RhcnR4cmVmCjY2NQolJUVPRgo="
    }
  ],
  "kvsKeys": [],
  "sourceStoreId": "",
  "inputDatasetId": "",
  "datasetUrlField": "url",
  "pageRange": "",
  "maxPages": 250,
  "includeMarkdown": true,
  "includeFullText": true,
  "includePerPageText": true,
  "extractLinksAndOutline": true,
  "removeHeadersFooters": true,
  "removePageNumbers": true,
  "preserveColumnOrder": true,
  "minTextCharsPerPage": 25,
  "ocrScannedPages": false,
  "chunkForRag": false,
  "chunkSizeChars": 1500,
  "chunkOverlapChars": 200,
  "maxConcurrency": 5,
  "maxPdfSizeMb": 30,
  "timeoutSecs": 30
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

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

No description

## `runSummary` (type: `string`):

No description

## `ppeLedger` (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 = {
    "base64Pdfs": [
        {
            "filename": "forgekit-sample-report.pdf",
            "dataBase64": "JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggMzA0ID4+CnN0cmVhbQpCVAovRjEgMTIgVGYKMSAwIDAgMSA3MiA3MjAgVG0gKEZvcmdlS2l0IFF1YXJ0ZXJseSBBdXRvbWF0aW9uIFJlcG9ydCkgVGoKMSAwIDAgMSA3MiA2OTAgVG0gKEV4ZWN1dGl2ZSBTdW1tYXJ5KSBUagoxIDAgMCAxIDcyIDY2NiBUbSAoUmV2ZW51ZSBncmV3IDQyIHBlcmNlbnQgeWVhciBvdmVyIHllYXIgYWNyb3NzIGVudGVycHJpc2UgQVBJIGFjY291bnRzLikgVGoKMSAwIDAgMSA3MiA2NDIgVG0gKEFsbCA4NSBjbG91ZCBwaXBlbGluZXMgbWFpbnRhaW5lZCA5OS45IHBlcmNlbnQgdXB0aW1lIGR1cmluZyBRNCAyMDI2LikgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagp4cmVmCjAgNgowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDAwMDkgMDAwMDAgbiAKMDAwMDAwMDA1OCAwMDAwMCBuIAowMDAwMDAwMTE1IDAwMDAwIG4gCjAwMDAwMDAyNDEgMDAwMDAgbiAKMDAwMDAwMDMxMSAwMDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDYgL1Jvb3QgMSAwIFIgPj4Kc3RhcnR4cmVmCjY2NQolJUVPRgo="
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("forgekit/pdf-to-markdown-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 = { "base64Pdfs": [{
            "filename": "forgekit-sample-report.pdf",
            "dataBase64": "JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggMzA0ID4+CnN0cmVhbQpCVAovRjEgMTIgVGYKMSAwIDAgMSA3MiA3MjAgVG0gKEZvcmdlS2l0IFF1YXJ0ZXJseSBBdXRvbWF0aW9uIFJlcG9ydCkgVGoKMSAwIDAgMSA3MiA2OTAgVG0gKEV4ZWN1dGl2ZSBTdW1tYXJ5KSBUagoxIDAgMCAxIDcyIDY2NiBUbSAoUmV2ZW51ZSBncmV3IDQyIHBlcmNlbnQgeWVhciBvdmVyIHllYXIgYWNyb3NzIGVudGVycHJpc2UgQVBJIGFjY291bnRzLikgVGoKMSAwIDAgMSA3MiA2NDIgVG0gKEFsbCA4NSBjbG91ZCBwaXBlbGluZXMgbWFpbnRhaW5lZCA5OS45IHBlcmNlbnQgdXB0aW1lIGR1cmluZyBRNCAyMDI2LikgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagp4cmVmCjAgNgowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDAwMDkgMDAwMDAgbiAKMDAwMDAwMDA1OCAwMDAwMCBuIAowMDAwMDAwMTE1IDAwMDAwIG4gCjAwMDAwMDAyNDEgMDAwMDAgbiAKMDAwMDAwMDMxMSAwMDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDYgL1Jvb3QgMSAwIFIgPj4Kc3RhcnR4cmVmCjY2NQolJUVPRgo=",
        }] }

# Run the Actor and wait for it to finish
run = client.actor("forgekit/pdf-to-markdown-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 '{
  "base64Pdfs": [
    {
      "filename": "forgekit-sample-report.pdf",
      "dataBase64": "JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggMzA0ID4+CnN0cmVhbQpCVAovRjEgMTIgVGYKMSAwIDAgMSA3MiA3MjAgVG0gKEZvcmdlS2l0IFF1YXJ0ZXJseSBBdXRvbWF0aW9uIFJlcG9ydCkgVGoKMSAwIDAgMSA3MiA2OTAgVG0gKEV4ZWN1dGl2ZSBTdW1tYXJ5KSBUagoxIDAgMCAxIDcyIDY2NiBUbSAoUmV2ZW51ZSBncmV3IDQyIHBlcmNlbnQgeWVhciBvdmVyIHllYXIgYWNyb3NzIGVudGVycHJpc2UgQVBJIGFjY291bnRzLikgVGoKMSAwIDAgMSA3MiA2NDIgVG0gKEFsbCA4NSBjbG91ZCBwaXBlbGluZXMgbWFpbnRhaW5lZCA5OS45IHBlcmNlbnQgdXB0aW1lIGR1cmluZyBRNCAyMDI2LikgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagp4cmVmCjAgNgowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDAwMDkgMDAwMDAgbiAKMDAwMDAwMDA1OCAwMDAwMCBuIAowMDAwMDAwMTE1IDAwMDAwIG4gCjAwMDAwMDAyNDEgMDAwMDAgbiAKMDAwMDAwMDMxMSAwMDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDYgL1Jvb3QgMSAwIFIgPj4Kc3RhcnR4cmVmCjY2NQolJUVPRgo="
    }
  ]
}' |
apify call forgekit/pdf-to-markdown-text-extractor --silent --output-dataset

```

## MCP server setup

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