# PDF to Markdown & Text with OCR (`inkbridge/pdf-to-markdown-text-with-ocr`) Actor

Convert PDF links to clean Markdown and text for RAG and LLMs. OCR for scanned pages, including Traditional and Simplified Chinese, Japanese and Korean. Pay per page; failed files cost nothing. PDF 轉 Markdown、掃描檔 OCR：繁體中文、简体中文、日本語、한국어。

- **URL**: https://apify.com/inkbridge/pdf-to-markdown-text-with-ocr.md
- **Developed by:** [Inkbridge Studio](https://apify.com/inkbridge) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 page converteds

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 with OCR

Give it PDF links. Get clean Markdown and plain text, ready for RAG, LLMs, search or spreadsheets. Scanned pages are read with OCR, including Chinese (Traditional and Simplified), Japanese and Korean.

### 中文、日本語、한국어

- **繁體中文 OCR：** 給 PDF 網址，轉成 Markdown 和純文字，掃描檔用 OCR 讀取，支援繁體中文、简體中文、日文、韓文與英文。每頁 US$0.002，OCR 頁 US$0.006。
- **简体中文 PDF：** 提供 PDF 链接，转换为 Markdown 和纯文本，扫描件使用 OCR 识别。每页 US$0.002，OCR 页 US$0.006。
- **日本語 PDF：** PDF の URL から Markdown とテキストに変換します。スキャン PDF は OCR で読み取ります。1 ページ US$0.002、OCR ページ US$0.006。
- **한국어 PDF:** PDF URL을 Markdown과 텍스트로 변환합니다. 스캔 PDF는 OCR로 읽습니다. 페이지당 US$0.002, OCR 페이지 US$0.006.

### What it does

- Keeps headings, paragraphs and ruled tables in Markdown.
- Uses OCR only on pages with no text layer, so normal pages stay fast and cheap. You can force OCR on or off.
- Reads English, Traditional Chinese, Simplified Chinese, Japanese and Korean.
- Tells you which files failed and why. One bad file does not stop the others.

### Use cases

- **RAG and LLM pipelines:** turn reports, manuals and contracts into Markdown before chunking and embedding.
- **Scanned documents in Asian languages:** read Traditional Chinese, Simplified Chinese, Japanese or Korean scans that normal PDF parsers return empty.
- **Search indexes:** get one row per page, so a hit can point to the page it came from.
- **Data entry:** pull ruled tables out of PDF reports without copying by hand.

### How to use it

1. Add public PDF links to **PDF URLs**.
2. Pick **OCR languages** if your scans are not in English.
3. Run it. You get one row per PDF, or one row per page if you turn on **One row per page**.

### Pricing

- US$0.002 per page with a text layer.
- US$0.006 per page read with OCR.
- A file that cannot be converted costs nothing.
- Each run also has a US$0.00005 start fee.

### Output

| Field | Meaning |
|---|---|
| url | The PDF link |
| totalPages, pagesConverted, ocrPages | Page counts |
| markdown | Markdown version |
| text | Plain text version |
| error | Why the file failed, otherwise empty |

With **One row per page**, each row also has page and ocr. A very large PDF is split into one row per page automatically, because a dataset row has a size limit.

### Limits

- Links must be public. Password-protected PDFs are reported as failed.
- 100 MB per file; 500 pages per file by default.
- Layout is detected from the page. Two-column papers can have lines mixed across columns, and tables without ruled lines come out as text.
- Images and charts are not described. OCR accuracy depends on scan quality.
- OCR output is plain text with no headings.

### Run it from code

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("inkbridge/pdf-to-markdown-text-with-ocr").call(run_input={
    "pdfUrls": [{"url": "https://example.com/report.pdf"}],
    "onePerPage": True,
})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row["url"], row.get("page"), row.get("markdown", "")[:200])
```

### FAQ

**Will a normal PDF be charged the OCR price?** Not in the default mode. OCR runs only on pages with no text layer, and only those pages cost US$0.006.

**Can I cap the cost?** Yes. Limit the pages per PDF in the input, or set a maximum charge for the run in the run options.

**What if one file fails?** The others still run. The failed file gets a row with the reason in **error**, and it costs nothing.

**Does it work with private links?** No. Links must be reachable without a login.

### Data

Files are processed only to produce your output, which stays in your own Apify storage. Convert only documents you have the right to use.

Questions or a file that fails? Open an issue on this Actor's Issues tab.

# Actor input Schema

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

Public links to PDF files, one per line.

## `ocr` (type: `string`):

Auto keeps normal pages fast and uses OCR only where a page has no text layer.

## `ocrLanguages` (type: `array`):

Languages in your scans. Pick only what you need; more languages run slower.

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

Stops reading a file after this many pages.

## `onePerPage` (type: `boolean`):

Save each page as its own row instead of one row per PDF.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://arxiv.org/pdf/1706.03762"
  ],
  "ocr": "auto",
  "ocrLanguages": [
    "eng"
  ],
  "maxPagesPerPdf": 500,
  "onePerPage": false
}
```

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

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

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

```

## MCP server setup

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

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/maWqxukzyrmPpBzF3/builds/PD2UtCCSCeFHFYEYW/openapi.json
