PDF to Markdown, Tables & RAG Chunks (with OCR) avatar

PDF to Markdown, Tables & RAG Chunks (with OCR)

Pricing

from $0.50 / 1,000 page processed (text layer)s

Go to Apify Store
PDF to Markdown, Tables & RAG Chunks (with OCR)

PDF to Markdown, Tables & RAG Chunks (with OCR)

Convert PDF, DOCX and image files to clean Markdown, tables as CSV and RAG-ready chunks with page numbers. Scanned pages are read with OCR. No API keys, pay per page, built for AI agents and LLM pipelines.

Pricing

from $0.50 / 1,000 page processed (text layer)s

Rating

0.0

(0)

Developer

Killis Haraway

Killis Haraway

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 hours ago

Last modified

Share

Turn PDF, Word (DOCX) and image files into clean Markdown, tables (rows + CSV) and RAG-ready chunks with page numbers. Scanned pages are read automatically with OCR. No API keys, no LLM calls, nothing to configure. You pay a fraction of a cent per page.

Built for AI agents and LLM pipelines: give it links (or upload a file), get back text your model can actually use.

What you get for each document

FieldWhat it is
markdownThe whole document as Markdown: headings (#, ##), paragraphs, bullet lists, tables, and <!-- page N --> markers
tablesEvery detected table with its page, rows (list of lists) and csv
chunksText split for embeddings: text, page_start, page_end, nearest heading, char_count
metadataTitle, author, subject, dates from the file properties
page_count, pages_text, pages_ocr, pages_emptyWhat was read and how
warnings, errorPlain-language notes and stable error codes (see below)

Each document's Markdown is also saved as a .md file in the run's key-value store.

Quick start

In the Console: paste one or more links into Document URLs (or upload a file) and click Start.

API (Python):

from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("errandkit/pdf-to-markdown-tables").call(run_input={
"documentUrls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"],
"outputMode": "documents",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["document_name"], item["page_count"], len(item["tables"]))
print(item["markdown"][:500])

RAG ingestion (one dataset item per chunk, ready for a vector database):

{
"documentUrls": ["https://example.com/handbook.pdf", "https://example.com/policy.docx"],
"outputMode": "chunks",
"chunkMaxChars": 1200,
"chunkOverlapChars": 150,
"includeMarkdown": false
}

Base64 input (for agents and back ends that already hold the file):

{"documents": [{"name": "invoice.pdf", "content_base64": "JVBERi0xLjcK..."}]}

Use it from an AI agent (MCP)

This Actor works as a tool in Claude, Cursor, ChatGPT connectors and other MCP clients through Apify's MCP server:

https://mcp.apify.com/?actors=errandkit/pdf-to-markdown-tables

The agent passes a link, the Actor returns Markdown, tables and chunks. Results are JSON with stable field names, so agents don't have to guess.

Input options

OptionDefaultNotes
documentUrls–Direct links to PDF, DOCX, PNG, JPEG, TIFF, GIF, BMP or WEBP files
uploadedFile–Upload one file in the Console
documents–JSON list of {name, url} or {name, content_base64}
outputModedocumentsdocuments = one item per file; chunks = one item per chunk
pagesallPDFs only, e.g. 1-3,7
ocrautoauto reads only pages without a text layer; force OCRs every page; off never
ocrLanguageengspa, fra, deu, por, ita, or combined like eng+spa
tablestrueDetect ruled tables in PDFs; all DOCX tables are kept
chunking, chunkMaxChars, chunkOverlapCharstrue, 1500, 150Chunks keep the nearest heading and page range; tables are split by rows with the header repeated
includeMarkdowntrueTurn off to keep items small
saveMarkdownFilestrueSave 001-name.md files to the key-value store
maxPagesPerDocument500Pages after this are skipped and not charged
failOnEmptytrueMark the run failed if no document has any text

Pricing

Pay per event. You only pay for pages that produced text.

EventPricePer 1,000
Page processed (text layer; DOCX counts 1 page per 3,000 characters)$0.0005$0.50
Page or image read with OCR$0.003$3.00
Actor start (Apify standard)$0.00005$0.05

Examples: a 10-page digital PDF costs $0.005; a 10-page scan costs $0.03. Blank pages, failed downloads, encrypted or broken files are not charged. Set Maximum cost per run and the Actor stops before going over it, keeping everything already finished.

Error codes

Every failed document gets an item with status: "error" and one of these codes. One bad file never stops the rest of the batch.

CodeMeaning
DOWNLOAD_FAILEDThe link returned an error (the HTTP status is included) or timed out
URL_NOT_ALLOWEDNot http(s), or points to a private network address
UNSUPPORTED_FORMATNot a PDF, DOCX or image (for example an HTML page, a ZIP, legacy .doc, or an Excel file)
FILE_TOO_LARGEOver 100 MB
PDF_ENCRYPTEDPassword-protected PDF
PDF_CORRUPT, DOCX_CORRUPT, IMAGE_CORRUPTThe file is damaged
PAGE_RANGE_INVALIDpages could not be parsed
OCR_LANGUAGE_UNAVAILABLEUnknown OCR language code
NO_TEXT_FOUNDNo text on any page (and OCR off, or the scan is unreadable)
MAX_COST_REACHEDYour maximum cost per run was reached

The run summary (OUTPUT in the key-value store) lists totals, the codes seen and the exact pages charged.

Good to know

  • Tables: PDF tables are found from their drawn cell borders. Tables made only of aligned text (no lines) come through as text paragraphs.
  • Columns: two-column pages are read left column first, then right. Complex magazine layouts may still mix.
  • OCR quality depends on the scan. 200 dpi Tesseract works well on typed documents, poorly on handwriting.
  • Not supported: password-protected PDFs, legacy .doc, PowerPoint, spreadsheets (use a spreadsheet tool), web pages.
  • Typical speed: about 4 digital pages per second; about 1 OCR page per second.

Privacy

Files are processed in memory inside your own Apify run. Nothing is sent to any third-party service or AI model, and nothing is kept by the developer. Output lives in your run's storage under your account and retention settings.

Feedback

Found a document that converts badly? Open an issue on the Actor's Issues tab with a public link to it.

Part of the Errandkit catalog of data tools, APIs and MCP servers for AI agents: https://errandkit.com