# PDF to Text Pro: Markdown, Tables, Metadata, RAG Chunks (`ucchiii/pdf-to-text-pro`) Actor

Convert public PDF links to plain text or Markdown with headings, lists and tables: rows per page, per document or as RAG chunks, plus tables as rows, metadata, password PDFs and Google Drive / Dropbox links. Scanned pages are skipped and free. Empty input = free demo.

- **URL**: https://apify.com/ucchiii/pdf-to-text-pro.md
- **Developed by:** [Actor Factory](https://apify.com/ucchiii) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.68 / 1,000 pdf documents

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 Text Pro converts public PDF links into clean Markdown or plain text — one row per page, one row per document with metadata, or ready-to-embed RAG chunks — and pulls every table out as its own row.**

- **Markdown that keeps the structure:** headings (`#` / `##` from font sizes), bullet and numbered lists, tables as Markdown tables, page markers.
- **Three output modes:** pages, whole documents, or RAG chunks with `pageStart` / `pageEnd` and overlap.
- **Tables as rows:** each table with its cells as a list of lists plus a Markdown version.
- **Metadata:** title, author, subject, creator, producer, creation and modification dates (ISO 8601), page count, encrypted flag.
- **Password-protected PDFs:** give one password for the run; it is never logged or written to the output.
- **Share links:** Google Drive file links and Dropbox links are turned into direct downloads automatically.

**Price: $2.40 per 1,000 PDFs (first 5 pages each) + $0.40 per 1,000 further pages.** Only PDFs with extractable text are charged. Scanned pages, failed downloads, wrong passwords and the demo are free.

**Try it free:** leave the input empty and press **Start** — a small public PDF is converted (not charged, rows carry `_demo: true`).

**Basic or Pro?** Need only the plain text of each page? The simpler [PDF to Text](https://apify.com/ucchiii/pdf-to-text) from the same developer charges $0.35 per 1,000 pages with no per-PDF fee — cheaper for short PDFs when you don't need Markdown, tables, metadata or chunks. This Pro version adds Markdown, document and chunk modes, table rows, metadata, passwords and share links.

### How to use

1. **PDF URLs**: public links to PDF files, one per line (up to 500 per run). Google Drive and Dropbox links shared as "Anyone with the link" work too.
2. Pick an **Output format** (`markdown` by default, or `text`) and an **Output mode** (`pages`, `document` or `chunks`).
3. Optional: **Tables as rows**, **Pages** (`1-5,8`, `3-`, `-2`), **Max pages per PDF** (default 200), **PDF password**, and for chunks **Chunk size** / **Chunk overlap**.

```json
{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://drive.google.com/file/d/<FILE_ID>/view?usp=sharing"
  ],
  "outputFormat": "markdown",
  "outputMode": "chunks",
  "chunkSize": 1500,
  "chunkOverlap": 150,
  "extractTables": true
}
```

Every PDF with text also gets a full-text file (`001-name.md` or `001-name.txt`) in the run's key-value store, with its download link in the rows (`fileUrl`) and in the `SUMMARY` record.

### Output modes

Every row has a `type`: `page`, `document`, `chunk`, `table` or `error`, and the `pdfUrl` you gave.

**`pages`** — one row per page:

| type | pdfUrl | page | text | charCount | scanned | tableCount |
|---|---|---|---|---|---|---|
| page | https://example.com/report.pdf | 1 | # Annual Report\n\n## Highlights\n\n- Revenue up 12% ... | 2,814 | false | 1 |
| page | https://example.com/report.pdf | 2 | | 0 | true | 0 |

**`document`** — one row per PDF: `text` (all pages), `title`, `author`, `subject`, `creator`, `producer`, `creationDate`, `modificationDate`, `pageCount`, `encrypted`, `pagesExtracted`, `pagesWithText`, `scannedPages`, `fileUrl`.

```json
{"type": "document", "pdfUrl": "https://example.com/report.pdf", "title": "Annual Report 2025", "author": "Finance team",
 "creationDate": "2025-03-01T09:30:00+01:00", "pageCount": 42, "encrypted": false, "text": "<!-- page 1 -->\n\n# Annual Report ..."}
```

**`chunks`** — RAG chunks: `pdfUrl`, `chunkIndex`, `pageStart`, `pageEnd`, `text`, `charCount`.

```json
{"type": "chunk", "pdfUrl": "https://example.com/report.pdf", "chunkIndex": 3, "pageStart": 4, "pageEnd": 5, "text": "## Outlook\n\nWe expect ..."}
```

*(illustrative rows showing the output format; the free demo shows real results)*

A PDF that cannot be read gives one row with `type: "error"`, `page: 0` and `error`: `http_404`, `not_a_pdf`, `file_too_large`, `timeout`, `password_required`, `wrong_password`, `unreadable_pdf`, `share_link_not_a_pdf` (the shared file is not public), `share_link_unsupported:onedrive`, `blocked_private_address`, `invalid_url`.

### Markdown & tables

- **Headings:** lines set in a larger font than the document's body text become `#` (largest size) or `##` (other larger sizes).
- **Lists:** lines starting with `•`, `-`, `*`, `–` and similar become `- item`; `1.` / `1)` lists keep their numbers.
- **Paragraphs:** lines of one paragraph are joined; a larger vertical gap starts a new paragraph.
- **Tables:** tables drawn with ruling lines are detected and written as Markdown tables in their place on the page (their text is not repeated as loose lines). With **Tables as rows**, each table is also a row: `page`, `tableIndex`, `rowCount`, `columnCount`, `rows` (list of lists) and `markdown`.
- **Page breaks:** in documents, chunks and files, each page starts with `<!-- page N -->`. Plain-text files separate pages with a form-feed character (`\f`).
- Tables without ruling lines come out as text lines; the structure detection is based on the PDF's text layer, so unusual layouts may need a check.

### RAG chunks

- Text is split on **paragraph** boundaries first, then **sentence** boundaries; only a sentence longer than the chunk size is cut at a word boundary.
- **`chunkSize`** (default 1,500 characters, 200 – 20,000) is a hard maximum.
- **`chunkOverlap`** (default 150): the last whole sentences of a chunk (up to that many characters) are repeated at the start of the next one, so context is not lost at the edges.
- Each chunk keeps `pageStart` and `pageEnd`, so answers can cite the page. Chunks are built per PDF and never mix documents.

### Pricing

Pay per event:

- **$0.0024 per PDF** with extractable text — covers its first 5 pages, metadata, tables and chunks. That is **$2.40 per 1,000 PDFs (first 5 pages each)**.
- **$0.0004 per extra page** — each page with text beyond the first 5 of a PDF ($0.40 per 1,000 pages).

Examples: a 5-page PDF costs $0.0024; a 10-page PDF costs $0.0024 + 5 × $0.0004 = $0.0044; a 120-page PDF with text on every page costs $0.0024 + 115 × $0.0004 = $0.0484.
**Free:** scanned or blank-only PDFs, blank and scanned pages, failed downloads, wrong or missing passwords, unsupported share links and the demo.
Set a **maximum charge per run** to cap spend: the Actor checks the budget before each PDF, stops cleanly when it is reached and keeps everything read so far.
Store discounts apply automatically: BRONZE −10%, SILVER −20%, GOLD −30%.

### Limits (cannot be raised by input)

- **No OCR:** scanned (image-only) pages have no text layer — they come back empty with `scanned: true` and are **free**. For scans, use [Tesseract OCR](https://apify.com/ucchiii/ocr-image-text) from the same developer.
- Up to **500 PDFs per run**, each up to **50 MB**, downloaded once within **60 seconds**, following at most 5 redirects.
- Up to **2,000 pages per PDF** (`maxPagesPerPdf`, default 200).
- Public files only: no login, no cookies. Links to internal network addresses are blocked.
- Google Drive: very large files show a virus-scan page instead of the file and return `share_link_not_a_pdf`. OneDrive / SharePoint sharing links are not supported (free error row) — use a direct public link instead.
- A document row holds up to 5 million characters; longer documents are complete in the `.md` / `.txt` file (`textTruncated: true`).

### FAQ

**Does it read scanned PDFs?** No. Scans need OCR, which this Actor does not do. Those pages are flagged `scanned: true` and cost nothing; a PDF with only scanned pages is not charged at all.

**Why is a heading missing or a line marked as a heading?** Headings are guessed from font size. Documents that use bold body-size text for headings keep those lines as normal text.

**Which tables are found?** Tables drawn with lines (borders or rules). Tables laid out with spaces only appear as text.

**Is my password safe?** It is used in memory only to open the PDFs of this run. It is never logged, never written to the dataset, the files or the `SUMMARY` record. A wrong password gives a free `wrong_password` row.

**Can I give a local file?** Upload it somewhere public first (an Apify key-value store, Google Drive or Dropbox shared as "Anyone with the link") and paste the link.

**Who owns the text?** The rights stay with the owners of the documents. Only process PDFs you are allowed to use.

### Use it from the API, Make, n8n or an AI agent (MCP)

Run it and get the rows back in one HTTP call (replace `<YOUR_TOKEN>` with your Apify API token):

```bash
curl -X POST "https://api.apify.com/v2/acts/ucchiii~pdf-to-text-pro/run-sync-get-dataset-items?token=<YOUR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"], "outputMode": "chunks", "chunkSize": 1000}'
```

The response holds the rows; the file links and metadata are in the run's `SUMMARY` record.

- **Make, n8n, Zapier:** use the Apify app / node, pick this Actor and pass the same JSON input.
- **AI agents (Claude, Cursor and other MCP clients):** add `https://mcp.apify.com?tools=ucchiii/pdf-to-text-pro` to your MCP settings.

If this Actor saved you time, a rating on the Store helps others find it.

### More tools from the same developer

- [PDF to Text Converter](https://apify.com/ucchiii/pdf-to-text) — plain text per page from public PDF URLs, plus one .txt file per PDF
- [Tesseract OCR](https://apify.com/ucchiii/ocr-image-text) — OCR for image URLs and scanned PDFs with built-in Tesseract: text, confidence and line boxes in 8 languages
- [HTML to Markdown Converter for LLM and RAG](https://apify.com/ucchiii/html-to-markdown) — clean Markdown from URLs, raw HTML or datasets for LLM and RAG
- [URL to PDF](https://apify.com/ucchiii/url-to-pdf) — save public web pages as PDF files: A4 or Letter, margins, page numbers
- [RAG Chunker](https://apify.com/ucchiii/rag-chunker) — split scraped pages into chunks for RAG and vector stores

# Actor input Schema

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

Public PDF links (http:// or https://), one per line. Google Drive file links (drive.google.com/file/d/…/view) and Dropbox links (?dl=0) are turned into direct downloads automatically; the file must be shared as 'Anyone with the link'. OneDrive / SharePoint sharing links are not supported (free error row). Each PDF is downloaded once (max 50 MB, 60 s, up to 5 redirects). Up to 500 PDFs per run. Leave empty for a free demo on a small public PDF (not charged).

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

Markdown: larger-than-body lines become # / ## headings, bullet and numbered lists are kept, ruled tables become Markdown tables, and each page starts with  in documents and files. Plain text: the PDF's text layer line by line.

## `outputMode` (type: `string`):

Pages: one row per page. Document: one row per PDF with the full text and the metadata (title, author, dates, page count). RAG chunks: the text split on paragraph and sentence boundaries into chunks of up to 'Chunk size' characters, each with pageStart and pageEnd.

## `chunkSize` (type: `integer`):

RAG chunks mode only: maximum characters per chunk (200 to 20,000, default 1,500).

## `chunkOverlap` (type: `integer`):

RAG chunks mode only: up to this many characters from the end of one chunk (whole sentences when possible) are repeated at the start of the next. 0 = no overlap; capped at half the chunk size.

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

Also write every table found (ruled tables) as its own row: pdfUrl, page, tableIndex, rows (list of lists) and markdown. Included in the PDF price.

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

Optional page range, 1-based, applied to every PDF: '1-5,8', '3-' (page 3 to the end) or '-2' (first two pages). Empty = all pages, up to the limit below. Pages past the end of a PDF are ignored.

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

Read at most this many pages of each PDF (1 to 2,000, default 200). Caps your cost on very long documents.

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

Optional: one password used to open every password-protected PDF in this run. It is used only in memory, never logged and never written to the output. A wrong or missing password gives a free error row (wrong_password / password_required).

## Actor input object example

```json
{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "outputFormat": "markdown",
  "outputMode": "pages",
  "chunkSize": 1500,
  "chunkOverlap": 150,
  "extractTables": false,
  "maxPagesPerPdf": 200
}
```

# Actor output Schema

## `rows` (type: `string`):

Every row: type (page, document, chunk, table or error), pdfUrl and the text or table. A PDF that could not be read gives one row of type error.

## `chunks` (type: `string`):

Chunks in RAG chunks mode: pdfUrl, chunkIndex, pageStart, pageEnd, text.

## `tables` (type: `string`):

With 'Tables as rows': pdfUrl, page, tableIndex, rows (list of lists) and markdown.

## `files` (type: `string`):

The key-value store with one .md or .txt file per PDF with text.

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

Record SUMMARY: per PDF the metadata (title, author, subject, creator, producer, dates, page count, encrypted), pages extracted, scanned pages, tables, charges, file link and error.

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ucchiii/pdf-to-text-pro").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"] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ucchiii/pdf-to-text-pro"
        }
    }
}
```

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/ITrnclTOxVtp30OV1/builds/ksdyd9cOXg3R2N8z1/openapi.json
