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
- ๐ค AI and RAG builders: feed papers, manuals and contracts to ChatGPT, Claude or a vector database as clean Markdown chunks.
- ๐ Search and knowledge bases: index reports, policies and documentation with titles, page numbers and metadata.
- โ๏ธ Legal, finance and research teams: pull the text out of filings, contracts, invoices and academic papers for review or analysis.
- ๐งพ Scanned archives: digitize scanned letters, forms and faxes with OCR in 100+ languages.
- ๐ Scraping pipelines: extract the PDFs another scraper found (tender documents, annual reports, datasheets).
What you get
- ๐ Markdown with structure: headings detected from font sizes (title, sections), bullet lists, paragraphs re-joined across lines and hyphenation. Running headers, footers and figure labels repeated on every page are removed.
- โ๏ธ RAG chunks: set a chunk size (e.g. 1,500 characters) and an overlap; chunks split on paragraph and sentence boundaries.
- ๐ Text per page: for answers that cite page numbers.
- ๐ท๏ธ Metadata: title, author, subject, keywords, creator/producer, created and modified dates, PDF version, page count, word count.
- ๐ OCR for scanned PDFs: pages without a text layer (scans, photos, faxes) are read with Tesseract OCR in 100+ languages, automatically and only for those pages. Each OCR page reports its confidence.
- โก Fast: a 15-page paper takes well under a second to extract. Up to 4 PDFs are processed in parallel.
How to use it
- Add one or more PDF URLs (direct links to the file).
- Choose Markdown (best for LLMs) or plain text.
- Optionally set a chunk size for RAG and turn on text per page.
- 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
- $0.003 per PDF extracted.
- $0.0001 per page extracted.
- $0.004 per OCR page, only for pages that needed OCR (scanned pages in Auto mode).
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
- Links must point to the PDF file itself, not to a viewer page or a login-protected portal.
- Tables, charts and multi-column layouts come out as text in reading order, not as structured tables.
- OCR quality depends on the scan: low-resolution or handwritten pages give lower confidence.
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();
- ๐ค AI agents (MCP): add the Apify MCP server to Claude, ChatGPT, Cursor or any MCP client and this Actor becomes a tool your agent can call.
- ๐ No-code (n8n, Make, Zapier): one HTTP request runs the Actor and returns the results, so any automation tool can use it. In n8n, add an HTTP Request node with method
POST, URLhttps://api.apify.com/v2/acts/richiedc95~pdf-text-extractor/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>and the JSON input above as the body, then send the items to Slack, Google Sheets, email or a CRM. Put a Schedule node in front for daily alerts. Make and Zapier have official Apify apps (Run an Actor โ Get dataset items). Ready-made n8n workflows (import from URL) and a step-by-step guide: n8n / Make / Zapier examples. - ๐ฅ Exports: download every run as JSON, CSV, Excel, XML or RSS, or read it through the Apify API.
Process new PDFs automatically
- Click Save as a new task with your input.
- 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).
- 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
- Open PDF to Text & Markdown Extractor (OCR, RAG Chunks, Metadata) on Apify, fill the form and click Start, or call it from your code with one HTTP request.
- Results come as JSON, CSV or Excel, and can be scheduled daily.
Related data APIs
- Image to Text OCR: Extract Text from Images & Screenshots: Extract text from images, photos, scans and screenshots (PNG, JPG, WebP, GIF, BMP, AVIF) with OCR in 100+ languages. Optional lines with positions and confidence. $0.002 per image; failed images are free.