| Price | $0.005 per converted document ($5 per 1,000) |
|---|---|
| Formats | PDF (text-based), DOCX, PPTX, XLSX/XLS, HTML, CSV, TXT, Markdown |
| Input | Public links, including Google Docs/Sheets/Slides, Google Drive, Dropbox and GitHub file links |
| Output | One JSON record per URL: Markdown, metadata, RAG chunks, status and error code |
| Not charged | Bad links, too-large files, unsupported formats, password-protected files, scanned PDFs |
What it does
- Tables that stay tables. Ruled and borderless ("booktabs") PDF tables are rebuilt as GitHub-flavored Markdown tables. Excel sheets keep multi-row headers, and Word tables keep their header row.
- Correct reading order. Multi-column PDFs are read column by column. Running headers, footers, crop marks and rotated side stamps are removed.
- Real headings. Font-size analysis turns PDF titles into
#/##/###headings, so chunks carry a meaningfulheadingPath. - RAG chunks built in. Heading-aware chunks of a size you pick (default about 512 tokens with 50 overlap). Tables are never cut mid-row; long tables are split by rows with the header repeated. Every chunk has
page,headingPathandtokenEstimate. - Reliable at scale. Each document is parsed in an isolated process with a timeout, so one broken file can't stall a run. File size is checked before the download completes.
Who it's for
- RAG and LLM app builders loading PDFs, manuals, policies and slide decks into a vector database.
- AI agent builders who want a "read this document" tool that returns compact Markdown instead of raw bytes.
- Analysts turning Excel reports into Markdown tables an LLM can reason over, or filings and papers into searchable text with page numbers for citations.
- Teams migrating knowledge bases from Word and PowerPoint into Markdown for docs sites and wikis.
Supported formats
| Format | What you get |
|---|---|
| PDF (text-based) | Headings, paragraphs in reading order, ruled and borderless tables, per-page output, metadata |
| Word (.docx) | Headings, lists, bold/italic, links, tables, metadata, page count |
| PowerPoint (.pptx) | One section per slide (## Slide N), text, tables, speaker notes |
| Excel (.xlsx, .xls) | One Markdown table per sheet with merged multi-row headers |
| HTML pages | Main content only, with navigation, menus, footers and scripts removed |
| CSV, TXT, Markdown | Clean Markdown or a Markdown table |
Scanned (image-only) PDFs are detected and returned with status: "needs_ocr" and not charged. Partly scanned PDFs are converted, and the image-only pages are listed in scannedPages.
Input example
{
"urls": [
"https://www.irs.gov/pub/irs-pdf/fw9.pdf",
"https://docs.google.com/document/d/YOUR_PUBLIC_DOC_ID/edit"
],
"chunkStrategy": "size",
"chunkSize": 512,
"chunkOverlap": 50
}
Main options: chunkStrategy (size, section, page or none), chunkSize (default 512), chunkOverlap (default 50), includeMarkdown, includePages, detectTables, saveMarkdownFile, maxPages (default 500), maxFileSizeMb (default 50), maxDocuments (default 100), timeoutSecs (default 180) and maxConcurrency (default 2).
Output example
{
"url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
"status": "ok",
"success": true,
"errorCode": null,
"format": "pdf",
"title": "Form W-9 (Rev. March 2024)",
"pageCount": 6,
"pagesConverted": 6,
"wordCount": 6370,
"estimatedTokens": 9491,
"tableCount": 2,
"markdown": "# W-9\n\n# Request for Taxpayer\n\n...",
"chunks": [
{
"index": 0,
"text": "# W-9\n\n# Request for Taxpayer ...",
"page": 1,
"pageEnd": 1,
"headingPath": "W-9 > Request for Taxpayer",
"hasTable": false,
"charCount": 1890,
"tokenEstimate": 472
}
],
"scannedPages": [],
"warnings": [],
"charged": true,
"billedUnits": 1
}
A failed or scanned file has the same shape, with a reason and charged: false:
{
"status": "needs_ocr",
"success": false,
"errorCode": "SCANNED_PDF",
"errorMessage": "This PDF has no text layer (scanned images). Run OCR first; you were not charged.",
"pageCount": 8,
"scannedPages": [1, 2, 3, 4, 5, 6, 7, 8],
"chunks": [],
"charged": false,
"billedUnits": 0
}
Error codes include NOT_FOUND, ACCESS_DENIED, FILE_TOO_LARGE, UNSUPPORTED_FORMAT, ENCRYPTED_PDF, SCANNED_PDF and TIMEOUT. Very large documents are saved as a .md file in the run's key-value store and returned as markdownUrl.
Pricing
Pay per event: $0.005 per successfully converted document (event document-converted), which is $5 per 1,000. Long documents count one extra event per additional 50 PDF pages or slides, or per 25,000 words for other formats, so a 10-page PDF is 1 event and a 120-page PDF is 3. Failed, scanned and skipped documents are free. You can set a maximum cost per run in Apify Console and the run stops cleanly when it's reached. The Store page always shows the current price.
Use it from an AI agent (MCP)
Add the Apify MCP server with only this tool loaded. Clients that support remote MCP servers (Claude, Cursor, VS Code and others) will open a browser window so you can sign in to Apify the first time.
https://mcp.apify.com/?tools=sourcewire/doc-to-markdown
Typical JSON config (Cursor ~/.cursor/mcp.json, and similar files in other clients):
{
"mcpServers": {
"apify": {
"url": "https://mcp.apify.com/?tools=sourcewire/doc-to-markdown"
}
}
}
For step-by-step setup in Claude Desktop, Claude Code, Cursor and VS Code, see How to add Apify tools to Claude or Cursor via MCP.
Tips for agents: check status first (ok, error or needs_ocr). Use estimatedTokens to decide whether to summarize or chunk before putting a document in context. For the smallest response, use chunkStrategy: "none" with includeMarkdown: true.
Call it from code
curl -X POST "https://api.apify.com/v2/acts/sourcewire~doc-to-markdown/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"urls":["https://www.irs.gov/pub/irs-pdf/fw9.pdf"],"chunkStrategy":"size","chunkSize":512}'
See Turn PDFs into RAG-ready chunks for a full Python example.
Privacy
Only the URLs you submit are downloaded. Files are kept in temporary storage for the conversion and deleted right after. Private or internal network addresses are blocked. The tool never logs in to any site, so links must be publicly accessible.
Limitations
- No OCR: image-only PDF pages are detected and flagged, not read.
- Legacy
.docand.pptfiles and password-protected files aren't supported. Re-save as.docxor.pptx. - Charts and images aren't described; images are dropped (alt text is kept for HTML and Word where available).
- Very complex PDF tables (nested headers, cells spanning many rows) may need light cleanup.
- Pages behind logins, paywalls or bot protection can't be fetched.