Document to Markdown for RAG: PDF, Word, Excel, PPT, OCR avatar

Document to Markdown for RAG: PDF, Word, Excel, PPT, OCR

Pricing

from $0.80 / 1,000 page converteds

Go to Apify Store
Document to Markdown for RAG: PDF, Word, Excel, PPT, OCR

Document to Markdown for RAG: PDF, Word, Excel, PPT, OCR

Convert PDF, DOCX, XLSX, PPTX and HTML into clean Markdown with real tables, headings and RAG-ready chunks. Scanned PDF pages are read with OCR in 8 European languages. Nothing is stored.

Pricing

from $0.80 / 1,000 page converteds

Rating

0.0

(0)

Developer

DocFlow Tools

DocFlow Tools

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a day ago

Last modified

Features

Limited permissions

Share

Document to Markdown for RAG — PDF, Word, Excel, PowerPoint, HTML + OCR

Turn PDF, DOCX, XLSX, PPTX and HTML files into clean Markdown for LLMs, search and RAG pipelines. You get headings, real Markdown tables, paragraphs re-joined across line breaks, and chunks that keep their heading path. Scanned PDF pages are read with OCR (Tesseract) in 8 European languages, only where needed. Each document is downloaded into memory, converted and discarded: the file itself is never saved, only the result in your dataset.

What you get

One dataset item per document URL:

FieldDescription
urlThe document URL you gave
statusok, or error if the file could not be downloaded or converted
errorReason of the failure (only when status is error)
typepdf, docx, xlsx, pptx or html, detected from the file content, not from the URL or extension
pagesPDF pages converted (always 1 for Word, Excel, PowerPoint and HTML)
ocrPagesHow many of those PDF pages were read with OCR
metadataPDF only: Title, Author, Subject, CreationDate, ModDate, Producer (when present) and totalPages
perPageOptional (includePerPage): [{page, ocr, markdown}] for each converted PDF page
markdownThe whole document as Markdown
markdownKeyOnly for very large results (Markdown over 4,000,000 characters): markdown is null and the full text is saved in the run's key-value store under this key (e.g. markdown-1)
chunksOptional (includeChunks, on by default): [{index, headings, text, chars}]

How each format is converted

  • PDF: headings detected from font size (lines at least 1.25x the body text size, up to 3 heading levels). Tables with at least two filled columns become Markdown tables. Words are not glued together and hyphenated line breaks are re-joined. Pages with no text layer (fewer than 25 characters) are rendered at 200 DPI and read with OCR.
  • Word (DOCX): headings from the Heading 1-6 / Title styles, paragraphs with a list style become - items, tables stay in their original position.
  • Excel (XLSX): one ## Sheet name section and one Markdown table per non-empty sheet. Cell values are used, not formulas. Up to 5,000 non-empty rows per sheet.
  • PowerPoint (PPTX): one ## Slide N: Title section per slide with bullet points (indented by level), tables and speaker notes as > Notes: ....
  • HTML: headings, lists, links and emphasis are kept; script, style, noscript and template are removed with their content. The whole page is converted (menus and footers included); there is no JavaScript rendering.

How chunks are built

The Markdown is split at every heading. Each chunk carries headings, the path of headings above it joined with > (for example Methods > Data collection), so the context survives retrieval. A chunk never exceeds chunkSize characters: long sections are cut at a paragraph break, or at a space if there is none nearby.

Use cases

  • Load PDFs, reports, manuals and slide decks into a vector database for RAG.
  • Give an AI agent the content of an Office file as Markdown it can read.
  • Make scanned PDFs searchable by extracting their text with OCR.
  • Turn Excel sheets into Markdown tables that LLMs understand.
  • Batch-convert a list of document links into one dataset you can export as JSON, CSV or Excel.

How to use

  1. Open the Actor in Apify Console and click Try for free (or Start).
  2. In Document URLs, paste one or more direct links to PDF, DOCX, XLSX, PPTX or HTML files.
  3. Optionally limit PDF pages (1-3,7), choose the OCR mode and languages, and the chunk size.
  4. Click Start. When the run finishes, open the Output tab or export the dataset.

Input example (field names exactly as the Actor reads them):

{
"documentUrls": [
"https://arxiv.org/pdf/1706.03762",
"https://example.com/files/quarterly-report.docx"
],
"pages": "1-5",
"ocrMode": "auto",
"ocrLanguages": ["eng", "spa"],
"includeChunks": true,
"chunkSize": 2000,
"includePerPage": false
}
InputDefaultNotes
documentUrls(required)http or https links, up to 50 MB each
pagesall pagesPDF only, e.g. 1-3,7. Ignored for other formats
ocrModeautoauto = OCR only pages without text, always = OCR every PDF page, never = no OCR
ocrLanguages["spa", "eng"]Any of spa, eng, fra, deu, ita, por, cat, nld. Unknown codes are ignored
includeChunkstrueReturn RAG chunks
chunkSize2000200 to 20,000 characters
includePerPagefalseAlso return Markdown per PDF page

Output example

{
"url": "https://example.com/files/annual-report.pdf",
"status": "ok",
"type": "pdf",
"pages": 3,
"ocrPages": 1,
"metadata": {
"Title": "Annual Report 2025",
"Producer": "LibreOffice 7.6",
"CreationDate": "D:20260115093000+01'00'",
"totalPages": 42
},
"perPage": [],
"markdown": "# Annual Report 2025\n\n## Summary\n\nRevenue grew in all regions...\n\n| Region | 2024 | 2025 |\n| --- | --- | --- |\n| North | 1.2 | 1.4 |\n",
"chunks": [
{
"index": 1,
"headings": "Annual Report 2025 > Summary",
"text": "## Summary\n\nRevenue grew in all regions...",
"chars": 1874
}
]
}

A failed document gets a short item like this, and the other documents keep going:

{ "url": "https://example.com/missing.pdf", "status": "error", "error": "download: Client error '404 Not Found' for url ..." }

Pricing

Prices by Apify discount tier: the prices below are for the Bronze tier. Free plan: 50 % off. Silver: 10 % off. Gold and higher: 20 % off. Apify applies the right price automatically.

Pay per event, in USD. Platform compute is included in the event prices.

EventPriceWhen it is charged
Actor start$0.00005Charged by Apify when a run starts, per GB of run memory (default memory: 2 GB)
document-processed$0.003Once per document converted successfully
page-converted$0.001Per PDF page converted from its text layer; one per Word, Excel, PowerPoint or HTML file
ocr-page$0.008Per PDF page read with OCR (instead of page-converted, not in addition)

Documents that fail to download or convert are not charged. Events are charged after the result is saved.

Examples:

  • One 15-page text PDF (2 GB run, start $0.0001): 0.0001 + 0.003 + 15 x 0.001 = $0.0181
  • 10 Word files: 0.0001 + 10 x (0.003 + 0.001) = $0.0401
  • One 20-page scanned PDF (ocrMode: auto): 0.0001 + 0.003 + 20 x 0.008 = $0.1631

With ocrMode: always, every PDF page is charged as ocr-page. You can set a maximum cost per run in Apify; when it is reached, the Actor stops before the next document.

Use it from code, AI agents and integrations

Apify API (runs the Actor and returns the dataset items in one call):

curl -X POST "https://api.apify.com/v2/acts/docflow-tools~document-to-markdown-rag/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"documentUrls": ["https://arxiv.org/pdf/1706.03762"], "pages": "1-3"}'

Python (pip install apify-client):

from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("docflow-tools/document-to-markdown-rag").call(
run_input={"documentUrls": ["https://arxiv.org/pdf/1706.03762"], "chunkSize": 1500}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["status"], item.get("type"), len(item.get("chunks", [])))

AI agents: the Actor can be called by AI agents (Claude, Cursor and other MCP clients) through the Apify MCP server at https://mcp.apify.com.

No-code: connect it to Make, Zapier or n8n through the Apify integrations, or run it on a schedule or webhook.

Limits and notes

  • Up to 50 MB per file; only http:// and https:// URLs; redirects are followed; download timeout 120 s.
  • Up to 2,000 pages per PDF in one run.
  • Supported: PDF, DOCX, XLSX, PPTX, HTML. Not supported: legacy .doc, .xls, .ppt, RTF, OpenDocument, image files (see Image to Text OCR below), password-protected files.
  • Documents are processed one after another, in the order given.
  • PDF tables drawn only with horizontal rules (common in academic papers) come out as text, not as a table.
  • Excel formulas are returned as their last saved value; a file never calculated by Excel may show empty cells.
  • OCR runs only on PDF pages, not on pictures embedded in Word or PowerPoint. OCR quality depends on the scan.
  • The Actor does not log in to websites and does not render JavaScript: the URL must return the file itself.

FAQ

Does it work with scanned PDFs? Yes. In auto mode each page without a text layer is read with Tesseract OCR in the languages you choose. Pages with text are not OCR'd, so ocr-page is only charged where it is needed.

Which OCR languages are available? Spanish (spa), English (eng), French (fra), German (deu), Italian (ita), Portuguese (por), Catalan (cat) and Dutch (nld). Choose only the ones in your documents.

Can I convert only some pages? Yes, with pages (for example 1-3,7). Only those pages are converted and charged.

What happens if one URL fails? You get an item with status: "error" and the reason, it is not charged, and the remaining documents are processed normally.

Is my document stored? The file is held in memory only while it is converted. What remains is the output you asked for (Markdown, chunks, metadata) in your own Apify dataset.

What if the result is huge? If the Markdown exceeds 4,000,000 characters, it is saved in the run's key-value store and the dataset item gives its key in markdownKey.