PDF to Markdown Converter: OCR, Tables, RAG avatar

PDF to Markdown Converter: OCR, Tables, RAG

Pricing

from $1.10 / 1,000 document converteds

Go to Apify Store
PDF to Markdown Converter: OCR, Tables, RAG

PDF to Markdown Converter: OCR, Tables, RAG

PDF to Markdown converter API for RAG and LLMs: clean Markdown, plain text or JSON chunks with page numbers. Tables, multi-column layouts, OCR for scanned pages. $0.0011 per PDF + $0.00012 per page ($0.001 per OCR page).

Pricing

from $1.10 / 1,000 document converteds

Rating

0.0

(0)

Developer

John Wilkinson

John Wilkinson

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

11 days ago

Last modified

Features

Limited permissions

Share

PDF to Markdown Converter for RAG & LLMs (OCR, Tables)

Convert PDF to Markdown, text or RAG chunks for LLMs and AI agents in one API call. $0.0011 per document + $0.00012 per page (a 10-page PDF costs $0.0023), and scanned pages with OCR cost $0.001. Failed files cost $0.0011. No GPU, no LLM, no per-month fee.

Give it PDF URLs or upload a file and get one dataset item per document: clean Markdown, plain text, or RAG-ready JSON chunks with page numbers, plus title, page count, language and a status/error field. Use it as a PDF to text converter, a scanned PDF OCR step, a PDF table extractor (tables become Markdown tables) or the ingestion step of a vector database pipeline (LangChain, LlamaIndex, n8n). Two-column layouts such as arXiv papers come out in reading order, and repeated headers, footers, and page numbers are removed.

What it does

  • PDF → Markdown: headings (#, ##, … detected from font size and weight), paragraphs re-flowed across line breaks, de-hyphenation, bullet and numbered lists.
  • Tables → Markdown tables (ruled tables, including rows stacked without horizontal lines). Choose markdown, text (tab-separated), or skip.
  • Multi-column layouts (scientific papers, reports): left column, then right column, with full-width titles and abstracts kept in place.
  • OCR for scanned pages (Tesseract 5): auto OCRs only the pages that have no text layer, so mixed documents stay cheap. Languages: English, German, French, Spanish, Italian, Portuguese or Dutch (one per run).
  • RAG chunking: heading-aware chunks with chunkSize (in approximate tokens). Each chunk has pageStart, pageEnd, and its headings path (e.g. ["3 Model Architecture", "3.2 Attention"]) for citations and filtering.
  • Page range (1-5,8,10-): convert only what you need and pay only for those pages.
  • Metadata: title (from PDF metadata or the first heading), word and table counts, total and processed pages, OCR page count, detected language, and the PDF's own title, author and dates.
  • Clean errors: each document gets status = success / empty / error (or skipped when the run's page cap or maximum charge was reached; skipped files are not charged) and a readable error (404, "Not a PDF (got HTML page)", password-protected, too large…). One bad URL never fails the run; only a run where no document could be converted finishes as Failed.
  • Fast and light: a 15-page paper converts in a few seconds, in 512 MB of memory. No GPU or ML models.

Input

FieldDefaultDescription
urls– (the form prefills a sample paper)List of PDF URLs ([{ "url": "https://…/file.pdf" }] or plain strings)
file–Upload a PDF from your computer (Console)
base64Files–API/agents: [{ "name": "a.pdf", "data": "<base64>" }]
outputs["markdown"]Any of markdown, text, chunks (RAG), pageTexts (Markdown per page, about 2x the size)
chunkSize512Approximate tokens per chunk (1 token ≈ 4 chars; chunks overlap by 64)
ocrautoauto (scanned pages only), off, force
ocrLanguageengeng, deu, fra, spa, ita, por, nld
pageRangealle.g. 1-10, 2,4,6-
tablesmarkdownmarkdown, text, skip
removeHeadersFooterstrueDrop running headers, footers, and page numbers (never applied if it would remove half or more of the document: the unstripped text is kept and a warning added)
maxPagesPerRun5000Total pages per run (max 20,000); documents beyond it get a skipped row and are not charged

Limits that are not in the input form: 500 pages per document (use pageRange for more) and 50 MB per file.

Example input

{
"urls": [
{ "url": "https://arxiv.org/pdf/1706.03762" },
{ "url": "https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.29.pdf" }
],
"outputs": ["markdown", "chunks"],
"chunkSize": 512,
"ocr": "auto"
}

Output

One dataset item per PDF (abridged):

{
"source": "https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.29.pdf",
"status": "success",
"error": null,
"title": "The NIST Cybersecurity Framework (CSF) 2.0",
"language": "en",
"totalPages": 32,
"processedPages": 32,
"ocrPages": 0,
"wordCount": 10450,
"tableCount": 4,
"pdfMetadata": { "Title": "The NIST Cybersecurity Framework (CSF) 2.0", "CreationDate": "D:20240215120000-05'00'" },
"markdown": "# The NIST Cybersecurity Framework (CSF) 2.0\n\n## National Institute of Standards and Technology\n\n…\n\n### Abstract\n\nThe NIST Cybersecurity Framework (CSF) 2.0 provides guidance to industry, government agencies, and other organizations to manage cybersecurity risks…",
"chunks": [
{
"chunkIndex": 3,
"text": "### Preface\n\nThe Cybersecurity Framework (CSF) 2.0 is designed to help organizations of all sizes and sectors…",
"pageStart": 4,
"pageEnd": 5,
"headings": ["The NIST Cybersecurity Framework (CSF) 2.0", "National Institute of Standards and Technology", "Preface"],
"charCount": 1901,
"approxTokens": 475
}
],
"warnings": []
}

A table from a government report comes out as:

| Notice Date | Effective | Received | Company | City | No. Of | Layoff/Closure |
|---|---|---|---|---|---|---|
| 06/22/2015 | 03/25/2016 | 07/01/2015 | Maxim Integrated Product | San Jose | 150 | Closure Permanent |

Download results as JSON, JSONL, CSV, or Excel, or read them through the Apify API. Run statistics are saved to RUN_SUMMARY in the key-value store.

Use it from code, LangChain, LlamaIndex, or an AI agent

from apify_client import ApifyClient
client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("jcwilk/pdf-to-markdown").call(run_input={
"urls": ["https://arxiv.org/pdf/1706.03762"], "outputs": ["markdown", "chunks"], "chunkSize": 400})
for doc in client.dataset(run["defaultDatasetId"]).iterate_items():
for ch in doc.get("chunks", []):
embed_and_store(ch["text"], metadata={"source": doc["source"], "page": ch["pageStart"], "section": ch["headings"]})

The Actor also works with the Apify MCP server, so Claude, Cursor, and other MCP clients can call it as a "read this PDF" tool.

Pricing (pay per event)

EventPrice
Actor start (per GB of run memory, minimum 1; runs use 512 MB)$0.004
Document converted (including empty documents)$0.0011
Page converted (text layer)$0.00012 ($0.12 per 1,000 pages)
Page converted with OCR$0.001 ($1 per 1,000 pages)
Failed document (download error, not a PDF, password, timeout)$0.0011

You pay for work done, success or failure. Every PDF is charged the document fee once, when processing starts, so a failed download, a non-PDF or a password-protected file costs the same $0.0011. Pages are charged as they are converted, including pages of a document that later fails. Examples (excluding the start fee): 10-page report $0.0023, 100-page manual $0.013, 20-page scanned contract $0.021. Batch many PDFs per run to spread the start fee, and use pageRange to pay for fewer pages. Set a maximum cost per run in Apify to cap spend: a page is converted only while the cap covers it (the first page of each started document always is), and the run stops cleanly at the limit. Limits: files up to 50 MB, 20 s download per file, 2 files in parallel.

FAQ

How is this different from LLM-based PDF parsers? It uses deterministic open-source parsing (pdfplumber, pypdfium2, Tesseract), so it's cheap, fast and repeatable. Very complex layouts (math formulas, charts) are not reconstructed the way vision-LLM parsers try to.

Does it work on scanned PDFs? Yes. With ocr: "auto" (the default), pages without a text layer go through Tesseract OCR. Set the language with ocrLanguage (seven Latin-script languages are installed; Chinese, Japanese, Korean and Arabic are not). With force, every page is OCR'd (useful when the text layer is broken).

How good are the tables? Ruled and grid tables (forms, financial and government reports) come out as clean Markdown tables. Tables drawn only with whitespace, such as "booktabs" tables in academic papers, are kept as text in reading order rather than turned into tables.

Can it handle two-column papers? Yes. Columns are read left, then right, and full-width titles and abstracts stay at the top.

What chunk size should I use? 300–800 tokens with 10–15% overlap suits most embedding models. Chunks follow heading and sentence boundaries where possible.

Is my document stored? Documents are processed in memory during the run. Only the results you see in the dataset are saved, under your Apify storage retention settings.

Password-protected PDFs? They return status: "error" with a clear message and cost the document fee charged when processing started ($0.0011).

Does it support DOCX or images? Not yet. It handles PDFs only, which keeps it fast and cheap.

How fast is it? Text-layer PDFs convert at about 0.2 s per page (roughly 5 pages per second) after download; a 15-page paper takes a few seconds. OCR is slower, typically 2–3 s per page and up to about 20 s for dense high-resolution scans at the default 512 MB. Set ocr to off if you only need text-layer PDFs.

Limitations

  • Math formulas come out as linear text, not LaTeX.
  • Whitespace-only tables are not converted into Markdown tables.
  • Images are not described or extracted; only text printed in the PDF (including figure captions) is kept.
  • Layout detection handles one or two columns. Three or more columns may interleave.

Open-source components

Built on libraries with permissive licenses: pdfplumber/pdfminer.six (MIT), pypdfium2 (Apache-2.0/BSD-3), Tesseract and pytesseract (Apache-2.0), py3langid (BSD-3). No AGPL or GPL dependencies.