Skip to the content.

PDF to Text & Markdown Extractor (OCR, RAG Chunks, Metadata)

โ–ถ Run it on Apify: no install, no login to any data source. Apifyโ€™s free plan includes monthly credit, enough for small runs.

Turn PDF files into clean text or LLM-ready Markdown in seconds. Paste PDF URLs and get, for each file: the full text with headings and lists, optional RAG chunks for embeddings, optional text per page for citations, and the document metadata (title, author, creation date, page count).

Built for AI pipelines, search indexes and data teams: no browser, no OCR guesswork on text PDFs, predictable pay-per-PDF pricing.

Who uses it

What you get

How to use it

  1. Add one or more PDF URLs (direct links to the file).
  2. Choose Markdown (best for LLMs) or plain text.
  3. Optionally set a chunk size for RAG and turn on text per page.
  4. Run it and download the results as JSON, CSV or Excel, or read them through the API.

Input fields

Field What it does Default
pdfUrls Direct links to the PDF files required
outputFormat markdown (headings, lists; best for LLMs) or text markdown
chunkSize Split the text into RAG chunks of this many characters (0 = off) 0
chunkOverlap Characters repeated between consecutive chunks 150
includePages Also return the text of each page, for citations false
maxPagesPerPdf Read only the first N pages (0 = all) 0
maxFileSizeMb Skip files larger than this 50
ocrMode auto (OCR only pages without text), force or off auto
ocrLanguages Tesseract languages, e.g. eng, spa, eng+deu eng
maxOcrPagesPerPdf Cap on OCR pages per file, to control cost 50

Input example

{
    "pdfUrls": ["https://arxiv.org/pdf/1706.03762"],
    "outputFormat": "markdown",
    "chunkSize": 1500,
    "includePages": false
}

Output example

{
    "url": "https://arxiv.org/pdf/1706.03762",
    "fileName": "1706.03762",
    "fileSizeBytes": 2215244,
    "pageCount": 15,
    "pagesProcessed": 15,
    "title": null,
    "author": null,
    "creator": "LaTeX with hyperref",
    "producer": "pdfTeX-1.40.25",
    "createdAt": "2024-04-10T21:11:43Z",
    "characters": 39010,
    "words": 6087,
    "pagesWithoutText": [],
    "needsOcr": false,
    "markdown": "# Attention Is All You Need\n\n...\n\n## Abstract\n\nThe dominant sequence transduction models are based on complex recurrent or convolutional neural networks...\n\n## 1 Introduction\n\n...",
    "chunks": [
        {
            "index": 0,
            "text": "# Attention Is All You Need ...",
            "characters": 1480
        }
    ]
}

Output fields

Field Description
url, fileName, fileSizeBytes Which file was read
pageCount, pagesProcessed Pages in the file and pages extracted
title, author, creator, producer, createdAt Document metadata (null when the PDF does not set it)
characters, words Size of the extracted text
markdown or text The full extracted content
chunks RAG chunks with index, text and characters (when chunkSize is set)
pages Text per page (when includePages is on)
ocrPages, pagesWithoutText, needsOcr Which pages were read with OCR, with confidence, and which stayed empty

Each PDF is one item. PDFs that cannot be read (not a PDF, password-protected, too large, unreachable) are not charged; they are listed with the reason in the SUMMARY record of the run.

Pricing

A 10-page PDF costs $0.0040; 1,000 ten-page PDFs cost $4.00. Failed files cost nothing. Use Max pages per PDF to cap long documents.

FAQ

Does it do OCR on scanned PDFs? Yes. In Auto mode, pages that have no text layer are rendered and read with Tesseract OCR; digital pages use their exact text. Set OCR languages for non-English documents (for example spa or eng+deu). ocrPages lists the pages read with OCR and their confidence; pages that stayed empty are in pagesWithoutText. A typical OCR page takes a few seconds; give the run more memory (2โ€“4 GB) for long scans.

Are tables preserved? Table cells come out as text in reading order. Complex tables may need post-processing.

Can I pass files from my computer? Upload them anywhere that gives a direct link (for example an Apify key-value store or a public bucket) and paste the links.

Is the PDF stored? No. Files are downloaded, extracted in memory and discarded; only the extracted text is saved to your dataset.

Password-protected PDFs? They are skipped and reported in the summary.

Word, Excel or images? Only PDF files are supported here. Export Word and Excel documents to PDF first. For photos, screenshots and other image files, use the Image to Text OCR Actor.

Limitations

Use it from your code, AI agents and automations

Python

from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("richiedc95/pdf-text-extractor").call(run_input={
    "pdfUrls": [
        "https://arxiv.org/pdf/1706.03762"
    ],
    "outputFormat": "markdown",
    "chunkSize": 1500
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

JavaScript

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('richiedc95/pdf-text-extractor').call({
    "pdfUrls": [
        "https://arxiv.org/pdf/1706.03762"
    ],
    "outputFormat": "markdown",
    "chunkSize": 1500
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();

Process new PDFs automatically

  1. Click Save as a new task with your input.
  2. Add a schedule to the task, or trigger it from another Actor with an integration (for example, run it on the document links a scraper just found).
  3. Read the latest results from one stable URL:
https://api.apify.com/v2/actor-tasks/<TASK_ID>/runs/last/dataset/items?token=<YOUR_APIFY_TOKEN>&status=SUCCEEDED&format=json

Run it

Document APIs: PDF to Text and Image OCR ยท All data APIs