PDF & Document to Markdown — RAG Chunks, Tables, OCR avatar

PDF & Document to Markdown — RAG Chunks, Tables, OCR

Pricing

from $1.00 / 1,000 page converteds

Go to Apify Store
PDF & Document to Markdown — RAG Chunks, Tables, OCR

PDF & Document to Markdown — RAG Chunks, Tables, OCR

Convert PDF, DOCX and PPTX to clean Markdown, JSON and RAG-ready chunks with tables and automatic OCR. $1 per 1,000 pages, no start or per-file fee.

Pricing

from $1.00 / 1,000 page converteds

Rating

0.0

(0)

Developer

firas_mosbehi

firas_mosbehi

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

13 days ago

Last modified

Share

Convert PDF, DOCX and PPTX (plus XLSX and HTML) to clean Markdown, JSON and ready-to-embed RAG chunks — with real table extraction and automatic OCR only where a page needs it.

💲 Pricing

$1 per 1,000 pages, $4 per 1,000 OCR pages, no start fee, no per-file fee.

  • A page is charged only after it has been converted successfully.
  • OCR pricing applies only to pages that have no text layer (scans, photos) — text pages in the same file stay at the normal price.
  • The optional Accurate layout engine (AI layout model, slower) is billed at the OCR page price for every page.
  • Never charged: failed downloads, encrypted or corrupted files, pages outside your pageRange, pages that produced no text.
  • Set a maximum cost per run in Apify and the Actor stops before exceeding it — it never converts pages it can't charge for.

How pages are counted: PDF = pages, PPTX = slides, XLSX = sheets, DOCX / HTML = one page per 3,000 characters of output.

📄 Output example

Markdown (markdown field of the document item):

## Quarterly Sales
Units sold per region.
| Region | Manager | Q1 units | Q2 units |
|----------|-----------|------------|------------|
| Region 1 | Manager 1 | 101 | 112 |

One chunk item (one dataset item per chunk):

{
"type": "chunk",
"sourceUrl": "https://example.com/report.pdf",
"chunkIndex": 4,
"text": "Remote work is allowed up to three days per week...",
"headingPath": ["Employee Handbook", "Working Hours", "Remote Work"],
"pageStart": 3,
"pageEnd": 4,
"tokenEstimate": 412
}

Each document item also contains title, language, pageCount, pagesProcessed, ocrPages, tables[] (each with page, markdown and rows), warnings[] and processingMs. Very large Markdown (over ~5 MB) is saved to the run's key-value store and linked as markdownUrl.

🎯 Use cases

  • RAG / vector DB ingestion — chunks carry their heading path and page span; load them straight into Pinecone, Qdrant, Weaviate, pgvector or Chroma.
  • AI agents — give an agent a clean Markdown view of any document.
  • Search indexing — index text and tables with page numbers for citations.
  • Document migration — move PDFs and Office files into wikis, CMSs or Git as Markdown.

🚀 How to use

  1. URLs — paste public or signed links (S3, Google Cloud Storage, Dropbox direct links…) into Document URLs.
  2. Files on Apify — upload files to a key-value store and list them in Files on Apify as {"storeId": "...", "key": "report.pdf"}.
  3. Run. Each document becomes one document item; each chunk becomes one chunk item. Use the Documents and RAG chunks views in the Output tab.

API call

curl -X POST "https://api.apify.com/v2/acts/frayess_mosbehi~doc-to-markdown-rag/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"documentUrls": [{"url": "https://example.com/report.pdf"}], "chunkSize": 800}'

Python / LangChain

from apify_client import ApifyClient
from langchain_core.documents import Document
run = ApifyClient("<APIFY_TOKEN>").actor("frayess_mosbehi/doc-to-markdown-rag").call(
run_input={"documentUrls": [{"url": "https://example.com/report.pdf"}]}
)
items = ApifyClient("<APIFY_TOKEN>").dataset(run["defaultDatasetId"]).iterate_items()
docs = [
Document(page_content=i["text"], metadata={"source": i["sourceUrl"], "headings": i["headingPath"], "page": i["pageStart"]})
for i in items if i["type"] == "chunk"
]

n8n / Make / Zapier

Use the official Apify app: action Run Actor with frayess_mosbehi/doc-to-markdown-rag, then Get dataset items and filter on type = chunk.

🔒 Privacy & security

  • Files are processed in memory or temporary storage only; nothing is kept after the run except your own results in your own Apify storage.
  • Document text is never logged — logs contain only file names, page counts and timings.
  • No third-party APIs: conversion and OCR run entirely inside the Actor container.
  • Downloads are protected: private/internal network addresses are refused (also after redirects), file type is checked from the file content, size is capped, and Office files are checked against zip bombs.

❓ FAQ

Which formats are supported? PDF, DOCX, PPTX, XLSX and HTML. Legacy .doc/.ppt/.xls are not supported — save them as the modern format first.

What are the limits? Default 100 MB per file and 500 pages per document (both configurable), and 10 minutes per document.

Fast or accurate layout? Fast (default) reads text-layer pages directly and OCRs scanned pages with Tesseract — it handles typical reports, papers and manuals, including two-column pages and ruled tables. Tables without borders stay as plain text, and tables inside scans are not detected. Accurate runs an AI layout model on every page and handles complex layouts and scanned tables, but is much slower and billed at the OCR page price.

How is OCR detected? With ocr: auto (default), each PDF page is checked for a text layer. Only pages without one are OCR'd and charged at the OCR price. Use always for PDFs whose text layer is broken, or never to skip scans entirely (those pages are reported in warnings and not charged).

Which OCR languages? English, French, German, Spanish, Italian, Portuguese and Dutch (eng, fra, deu, spa, ita, por, nld).

How is billing counted? One page-converted event per converted text page, or one ocr-page-converted event per OCR page — never both for the same page. Chunks, tables and JSON output are included at no extra cost.

What happens with an encrypted or broken file? You get a document item with error set and nothing is charged.