PDF & DOCX to Markdown for AI and RAG avatar

PDF & DOCX to Markdown for AI and RAG

Pricing

from $3.00 / 1,000 document converteds

Go to Apify Store
PDF & DOCX to Markdown for AI and RAG

PDF & DOCX to Markdown for AI and RAG

Document parser: convert PDF, DOCX, HTML and text files into clean Markdown with headings, tables and lists, plus optional RAG chunks. Scanned pages are read with built-in OCR. No external API, Cyrillic and legacy encodings supported.

Pricing

from $3.00 / 1,000 document converteds

Rating

0.0

(0)

Developer

Maine Wayne

Maine Wayne

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Features

Limited permissions

Share

PDF & DOCX to Markdown for AI Agents and RAG

Turn PDF, DOCX, HTML and text files into clean Markdown with real structure: headings, paragraphs, bullet lists and tables. Optionally get RAG-ready chunks with heading and page references. No external API, no API keys, no OCR service: the conversion runs inside the Actor. Works with Cyrillic and other non-Latin text.

A document parser and PDF-to-text converter built for AI agents, LLM pipelines, knowledge bases, document search and anyone who needs readable text out of documents at scale.

What it does

  • PDF: reads the text layer with layout analysis. Headings are detected from font size, two-column pages are read column by column, wrapped lines are joined into paragraphs (hyphenated words are repaired), bullet lists and aligned tables become Markdown, repeated headers, footers and page numbers are removed.
  • DOCX: headings, bold/italic, lists, tables, links. Images are skipped.
  • HTML: the main content of a page as Markdown (navigation, banners and small forms dropped; relative links made absolute; older encodings such as windows-1251 read correctly, also when the page does not declare its encoding). Pages built inside one big form or with layout tables, common on older government sites, are read too.
  • Plain text / Markdown: passed through (UTF-8, UTF-16 and legacy 8-bit encodings).
  • Chunks (optional): pieces of about N tokens that follow document structure, with optional overlap, the nearest heading and the page range of each chunk.
  • Safety flags: hiddenTextChars reports invisible text inside a PDF (useful to spot hidden prompt-injection text before feeding a document to an LLM).
  • Scanned PDFs (OCR): pages without a text layer are rendered and read with an OCR engine that runs inside the Actor (14 languages including Bulgarian, Russian, Greek). Text pages never use OCR, so mixed documents are handled page by page. A scanned page that carries only a stamp or a page number as real text is recognised as a scan and read with OCR too. Scanned pages are straightened and turned upright before reading.
  • Clear errors: password-protected files, corrupt or oversized files, and documents that yield no text get a plain-language message and are not billed.

Input

FieldDescription
urlsPublic http(s) links to documents (up to 100 per run). robots.txt is respected, also for redirect targets.
inlineDocumentsSmall files as base64: [{"filename": "a.pdf", "contentBase64": "..."}] (max 20 files, 8 MB total). A data:...;base64, prefix is accepted.
includePagesAdd one Markdown string per PDF page.
chunkSizeTokens / chunkOverlapTokens0 = no chunks. Token counts are estimates.
removeHeadersFootersDrop repeated headers, footers and page numbers (PDF, 3+ pages).
maxPagesPerDocumentConvert only the first N PDF pages (default 200, max 1000).
maxFileSizeMbSkip larger files (default 25, max 50).
ocrauto (default): scanned pages are read with OCR; off: scanned pages are skipped.
ocrLanguages1 to 3 languages of scanned text, e.g. ["bul", "eng"] (default eng).
maxOcrPagesPerDocumentCap on OCR'd pages per PDF (default 50, max 200).

Example input

{
"urls": ["https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf"],
"chunkSizeTokens": 500,
"chunkOverlapTokens": 50
}

Output (one item per document)

{
"source": "https://.../report.pdf",
"status": "ok",
"format": "pdf",
"title": "Quarterly Report 2026",
"pageCount": 3,
"pagesConverted": 3,
"billedPages": 3,
"ocrPages": 0,
"ocrConfidence": null,
"wordCount": 136,
"hiddenTextChars": 0,
"warnings": [],
"markdown": "# Quarterly Report 2026\n\nThis report summarises...\n\n## Highlights\n\n- Revenue up 12 percent\n...",
"chunks": [{ "index": 0, "text": "...", "tokens": 54, "heading": "Quarterly Report 2026", "pageStart": 1, "pageEnd": 1 }]
}

Failed documents are returned with "status": "error" and an error message.

Ready-made examples

Saved examples you can open, run and copy:

Pricing

Pay per event: a small fee per document converted (document-processed), a small fee per text page (page-processed: one PDF page with a text layer, or about 3,000 characters for DOCX, HTML and text) and a higher fee per scanned page read with OCR (ocr-page-processed). Failed documents are free; failed OCR pages are not billed. Set Max cost per run to cap spending: the Actor never converts or charges more than your limit allows and cuts a long PDF at the last affordable page (truncated: true). See the pricing panel on this page for current prices.

Limits and honest notes

  • OCR is statistical: always spot-check numbers and names in scanned pages. Use the right ocrLanguages and scans of 150 DPI or more. Tilted and sideways pages are corrected automatically; blurred or very small print still reduces accuracy. Standalone images: use the Image OCR Actor.
  • Layout analysis is heuristic. Simple documents, reports, papers and contracts work well; complex layouts (overlapping text boxes, text in vector drawings, rotated pages) can come out in a different reading order. Tables are detected when columns line up; merged cells are not supported.
  • Bullet lists are detected from bullet characters or consistent indentation. Lists drawn as pictures cannot be detected.
  • Legacy .doc/.xls/.ppt, encrypted files and images are not supported.
  • Only the files you point it to are fetched (no crawling). Private network addresses are blocked.
  • You are responsible for having the right to process the documents you submit.

FAQ

Does it send my documents to a third-party AI or API? No. Files are processed inside the Actor run; nothing is sent to an outside conversion service.

Does it work with Bulgarian, Russian, Greek and other scripts? Yes. Text in a PDF's text layer is extracted as-is; scanned pages are read with OCR when you set the right ocrLanguages (for example bul, rus, ell).

Can an AI agent call it? Yes, through the Apify API or MCP server. Use inlineDocuments for small files or urls for public files.

Why was my URL refused? The site's robots.txt disallows automated access, the host is not public, or the file exceeds the size limit. The error message says which.

What does a scanned page cost? The OCR page fee shown in the pricing panel, instead of the text page fee. Set ocr: off to never use OCR.

Why is a table not detected? Tables are recognised from aligned columns in the text layer. Try includePages and check the page, or open an issue with an example.