How to turn a PDF or Word file into Markdown with OCR and RAG chunks

A short path for anyone who needs PDF to text, including scanned pages, without a separate OCR or AI API. Author: Public Records (I maintain the Actor).

Open the Actor on Apify →

What you get

The PDF to Text & Markdown Extractor takes PDF or Word (.docx) links and returns clean Markdown, OCR for scanned pages, and text chunks with heading paths — ready for a vector database or an LLM prompt.

1. Run the Store example

On the Store page, keep the example input (a text PDF and a scanned PDF, OCR on Auto, chunk size 400) and start a run on your Apify account. The free tier is enough to try it. Pay per event after that; current rates are on the Store page.

2. Or pin it in MCP

Paste https://mcp.apify.com?tools=publicrecords/pdf-docx-to-markdown into Claude, Cursor, or another MCP client and sign in with your own Apify account.

3. Or schedule it in n8n or Make

Import templates/n8n/pdf-docx-to-markdown.json (Workflows → Import from file) and add a Header Auth credential Authorization: Bearer <APIFY_TOKEN>. The Make HTTP recipe is in templates/make. Use your token; never commit it.

POST https://api.apify.com/v2/acts/publicrecords~pdf-docx-to-markdown/run-sync-get-dataset-items
Authorization: Bearer <APIFY_TOKEN>
{"documentUrls":["https://arxiv.org/pdf/1706.03762"],"ocrMode":"auto","chunkSize":400}

Sample from the Actor README (real output, not invented): Hugging Face explorer.

Hub: PDF to Text & Markdown docs.