# PDF Text Extractor: PDF to Markdown & Text for LLMs (`lineagersiui/pdf-text-extractor`) Actor

Extract the text layer of PDFs from URLs to clean Markdown (headings, paragraphs, lists) or plain text, per document or per page. No OCR. Pay only for pages with text, at most 15 per document. Free demo.

- **URL**: https://apify.com/lineagersiui/pdf-text-extractor.md
- **Developed by:** [Lineage RSIUI](https://apify.com/lineagersiui) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.30 / 1,000 page extracteds

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 Text Extractor: PDF to Markdown & Text for LLMs

**Turn PDFs into clean Markdown or plain text.** Give it links to PDF files. For each document it returns the text layer as:

- **Markdown:** headings (detected from font size), paragraphs, bulleted and numbered lists, with page markers;
- **or plain text:** line by line.

Output is one item per document, or one item per page for chunking in RAG and LLM pipelines.

### Try it free first

Run it with empty input. A **free demo** extracts the first 5 pages of RFC 9309, which isn't billed, so you can see the output format.

### What it does and doesn't do

- **Text layer only, no OCR.** Scanned PDFs (images of text) have no text layer. Those pages come back empty, are listed in `pagesWithoutText`, and **aren't billed**.
- **No tables or images.** Table cells come out as text in reading order, and images are skipped.
- **Headings are heuristic.** They're detected from font size and spacing, so unusual layouts may get extra or missing headings.
- **Untrusted files are handled safely.** Scripts inside PDFs are never run and nothing is rendered. Each file is parsed in an isolated worker with time and memory limits.
- **Languages:** Chinese, Japanese and Korean PDFs are supported through pdf.js's bundled character maps. Exotic custom encodings may still lose text.

### How to use it

1. Paste your **PDF URLs** (up to 100 per run, 50 MB each, 500 MB in total).
2. Tick **I have the right to process these documents**. Runs without it are refused.
3. Choose **Markdown** or **plain text**, and per-document or per-page output.
4. Optionally set **Maximum pages per PDF** (default 200, up to 500).

### Output

Each dataset item has:

- `url`, `title`, `totalPages`, `pagesRead`, `pagesWithText`, `pagesWithoutText`, `truncated`, `format` and `bytes`;
- `content` for the document, or for each page with `page`.

Documents over 8 MB of text are saved whole to the run's key-value store, named by `contentKey`, and the item carries the first 200 KB. Failed documents carry an `error`:

- `not_a_pdf`, `encrypted`, `invalid_pdf`, `parse_error`, `timeout` or `too_complex` (the file needed too much memory);
- `http_404` and other HTTP errors, `too_large` and `too_many_redirects`;
- `blocked_by_robots`, `blocked_private_address`, `scheme_not_allowed` or `denied_host`;
- `duplicate_document` (the same file under another URL), `run_limit_reached` or `time_limit_reached`.

Failed documents are never billed.

A `SUMMARY` record holds the counts.

### Polite and safe by design

- **robots.txt:** honoured for every host, including `Crawl-delay`.
- **Pacing:** within a run, at most one request at a time per server, at least 500 ms apart, and at most 25 PDFs per site.
- **Addresses:** private and internal network addresses are refused at every redirect.
- **What it never sends:** cookies or credentials. It never tries to get around access controls or anti-bot protection.
- **Identification:** the user agent is `PdfTextExtractor/1.0`, with a link to this page.
- **Site owners** can opt out with `User-agent: PdfTextExtractor` and `Disallow: /` in robots.txt. To report misuse, open an issue on this Actor's **Issues** tab.

### Pricing

- **Pay per event:** each page with real text (at least 20 characters) is one `page-extracted` event. **At most 15 pages are billed per document**, however long it is.
- **Not billed:** pages with fewer than 20 characters of text (blank or scanned pages, or a page number only), pages beyond your page limit, failed or duplicate documents, output that couldn't be saved, and the demo. A scanned page with a longer text stamp or banner counts as a page with text.
- The price is shown on the Pricing tab. You can cap the maximum charge per run in Apify's run options.

### Terms of use

- **Your rights:** only process documents you own, that are licensed to you, or that you are otherwise allowed to use. You are responsible for copyright compliance.
- **Personal data:** if the documents contain personal data, you are responsible for having a lawful basis to process it.
- **Where text goes:** extracted text is stored only in your run's dataset and key-value store. The developer doesn't keep it or read it, and logs hold counts only.
- **Limits per run:** 100 PDFs, 50 MB per PDF, 500 MB in total, and 25 PDFs per site.

### About

- **Independent:** made by an independent developer. Unofficial; not affiliated with or endorsed by Apify.
- **Built with AI:** built and maintained with the help of AI tools, under the developer's direction. Uses Mozilla's pdf.js (Apache-2.0).

# Actor input Schema

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

Public http(s) links to PDF files: up to 100 per run, 50 MB each, 500 MB in total, 25 per site.

## `confirmRights` (type: `boolean`):

Required for non-demo runs. Only process documents you own, that are licensed to you, or that you are otherwise allowed to use. You are responsible for copyright and data-protection compliance.

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

Markdown keeps headings, paragraphs and lists; plain text keeps the original line breaks.

## `outputPerPage` (type: `boolean`):

Off: one item per document. On: one item per page (useful for chunking).

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

Pages after this are skipped and not charged.

## `timeLimitSecs` (type: `integer`):

No new PDFs are started after this time. Unprocessed PDFs are not charged.

## Actor input object example

```json
{
  "confirmRights": false,
  "outputFormat": "markdown",
  "outputPerPage": false,
  "maxPagesPerPdf": 200,
  "timeLimitSecs": 1500
}
```

# Actor output Schema

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

No description

## `summary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("lineagersiui/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 = {}

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

```

## MCP server setup

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