PDF to Markdown & PDF Parser API: OCR, DOCX, Tables $3/1K
Pricing
from $1.80 / 1,000 document converteds
PDF to Markdown & PDF Parser API: OCR, DOCX, Tables $3/1K
PDF parser & PDF to Markdown/text for RAG: scanned PDF OCR, DOCX, tables, page chunks. $3 per 1,000 docs, OCR $0.01/page, failed files free. API ready.
Pricing
from $1.80 / 1,000 document converteds
Rating
0.0
(0)
Developer
Haniel Azevedo
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
10 days ago
Last modified
Categories
Features
Share
PDF parser, PDF to Markdown converter and PDF text extractor: turn any PDF, scanned PDF, Word file, web page or image into clean Markdown or plain text that an LLM can read, with OCR only where a page really needs it.
Supported formats: PDF, scanned PDF, DOCX, ODT, RTF, EPUB, HTML, TXT/MD and images (PNG, JPG, TIFF, WEBP, BMP, GIF). Each document becomes one dataset item with metadata, optional RAG chunks (heading path and page range), a downloadable .md file, and a machine-readable error code if something goes wrong.
- 📄 PDF text layer first, page by page. Tesseract 5 OCR runs only on scanned or image-only pages, or on every page if you ask for it.
- 📝 Office and web formats via Pandoc: headings, lists, links and tables as GitHub-flavoured Markdown. Navigation, cookie banners, footers and sidebars are stripped from HTML.
- ✂️ RAG chunking: heading-aware chunks with overlap, approximate token counts, character offsets and
pageStart/pageEnd. - 🛡️ Reliable at scale: one bad file never fails the run. Hard size, page and time limits, SSRF protection, and stable error codes for automatic retries.
- 💸 $3 per 1,000 documents, plus $0.01 per OCR page. Failed documents are free. PDF pages with a text layer are never charged as OCR.
Who it's for
- AI and RAG builders loading document libraries into Pinecone, Weaviate, Qdrant, pgvector or LangChain/LlamaIndex pipelines, with page citations.
- AI agents and LLM apps (GPT, Claude, Grok, Llama) that need clean Markdown instead of noisy PDF text, which also uses fewer tokens.
- Back-office automation: scanned invoices, receipts and forms OCR'd and passed to an extraction prompt or regex.
- Docs and knowledge-base teams moving DOCX, ODT, EPUB and HTML to Markdown for docs sites, wikis, Notion or Obsidian.
- Legal, compliance and research: bulk text from contracts, tenders, court filings and papers, ready for search and review.
Try it
Click Start without changing anything. The default input converts a scanned, image-only PDF (a 1964 White House memo with no text layer, public domain from the US National Archives) and a real 15-page research paper:
{"urls": ["https://upload.wikimedia.org/wikipedia/commons/2/2f/Memorandum_Notifying_President_Johnson_of_Attack_on_the_U.S.S._Maddox_-_DPLA_-_fd57bf521aad09e3a45e5ee9468134e4.pdf","https://arxiv.org/pdf/1706.03762v7"]}
It finishes in about 10 seconds and returns 2 items. The scanned memo has no text layer, so OCR runs on its one page ("ocrPagesUsed": 1, about 94% mean confidence) and returns readable text: "Early this morning the USS Maddox was attacked by three DRV PT boats while on patrol approximately 30 miles off the North Vietnamese coast in the Gulf of Tonkin." The paper has a text layer, so it needs no OCR and returns about 38,000 characters of Markdown with # Attention Is All You Need, ### Abstract and the numbered section headings. The run costs $0.016 (2 × $0.003 per document + 1 OCR page × $0.01). An empty input {} does the same. Then replace the URLs with your own, or upload files in the Files field.
How to convert PDF to Markdown (step by step)
- Open the Input tab and paste one or more PDF, DOCX or web page links into Document URLs, or upload files in Upload files.
- Keep Output format on
markdown(or choosetextfor plain text). - Leave OCR mode on
auto: pages with a text layer are read directly and only scanned pages go through OCR. Set OCR languages if your scans aren't English or Portuguese. - For RAG, turn on Split into RAG chunks and set the chunk size and overlap.
- Optional: set Maximum cost per run in the run options to cap spend.
- Click Start. When the run finishes, open the Output tab, download the
.mdfiles from the key-value store, or export the dataset as JSON, CSV or Excel.
Input
Use any combination of these:
| Field | What it does |
|---|---|
urls | Public http(s) links. The format is detected from the file content, not the extension. |
files | Files uploaded in the Apify Console (stored in a key-value store). |
keyValueStoreId (+ keyValueStoreKeys) | Convert every record in one of your key-value stores (up to 1,000), or only the keys you list. The Actor gets read-only access to that store only. |
outputFormat | markdown (default) or text. |
ocrMode | auto (default: OCR only pages with no usable text), always, or never. |
ocrLanguages | Tesseract codes joined with +. Installed: eng, por, spa, fra, deu, ita, nld. Default eng+por. |
maxPages | Convert only the first N pages per document (this caps OCR cost). |
enableChunking, chunkSize, chunkOverlap | RAG chunks. Defaults: off, 1,500 and 150 characters. |
includeContentInDataset | Set to false to keep only metadata and the .md file link in the dataset. |
maxFileSizeMb, timeoutSecondsPerDocument, maxConcurrency | Limits. Defaults: 50 MB, 600 s, 2 documents in parallel. |
{"urls": ["https://example.com/contract.docx","https://example.com/scanned-invoice.jpg"],"outputFormat": "markdown","ocrMode": "auto","ocrLanguages": "eng+por","maxPages": 200,"enableChunking": true,"chunkSize": 1500,"chunkOverlap": 150}
API example (synchronous, returns the dataset items):
curl -X POST "https://api.apify.com/v2/acts/hanielazevedo~document-to-markdown-ocr/run-sync-get-dataset-items" \-H "Authorization: Bearer $APIFY_TOKEN" -H 'Content-Type: application/json' \-d '{"urls":["https://arxiv.org/pdf/1706.03762v7"]}'
Use with AI agents (MCP) and Python
MCP: add this Actor as a tool in Claude Desktop, Cursor, VS Code or any MCP client through the Apify MCP server: https://mcp.apify.com?tools=hanielazevedo/document-to-markdown-ocr (sign in with your Apify account or pass your API token). The agent sees the input schema and can run the Actor and read the dataset itself.
Python (pip install apify-client):
from apify_client import ApifyClientclient = ApifyClient("<YOUR_APIFY_TOKEN>")run = client.actor("hanielazevedo/document-to-markdown-ocr").call(run_input={"urls": ["https://arxiv.org/pdf/1706.03762v7"],"outputFormat": "markdown","enableChunking": True})for item in client.dataset(run["defaultDatasetId"]).iterate_items():print(item)
Each item has the Markdown in item["markdown"] and, with chunking on, the RAG chunks in item["chunks"]. The run-sync-get-dataset-items endpoint above does the same in one HTTP call.
Sample output
One item per document. This is the PDF item from a run with the default input (Markdown shortened, the rest unchanged). The full Markdown is also saved as a .md file in the run's key-value store and linked in outputFileUrl.
{"index": 0,"url": "https://arxiv.org/pdf/1706.03762v7","source": "url","filename": "1706.03762v7.pdf","mimeType": "application/pdf","detectedFormat": "pdf","bytes": 2215244,"status": "success","format": "markdown","title": null,"pages": 15,"pagesProcessed": 15,"ocrPagesUsed": 0,"ocrConfidence": null,"characters": 38296,"words": 5804,"markdown": "### Provided proper attribution is provided, Google hereby grants permission to reproduce the tables and figures in this paper solely for use in journalistic or scholarly works.\n\n# Attention Is All You Need\n\nAshish Vaswani∗\nGoogle Brain\navaswani@google.com\n\n…\n\n### Abstract\n\nThe dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder. …\n\n### Introduction\n\n…","text": null,"outputFileKey": "0001-1706.03762v7.md","outputFileUrl": "https://api.apify.com/v2/key-value-stores/<run-store-id>/records/0001-1706.03762v7.md?signature=…","chunkCount": null,"chunks": null,"warnings": [],"error": null,"errorCode": null,"durationMs": 2075,"charged": {"document-converted": 1, "ocr-page": 0}}
The scanned memo from the same run: "detectedFormat": "pdf", "pages": 1, "ocrPagesUsed": 1, "ocrConfidence": 93.8, 894 characters, and "charged": {"document-converted": 1, "ocr-page": 1}.
With enableChunking: true, each item also has chunks such as:
{"index": 0, "text": "# Attention Is All You Need\n\n…", "chars": 1480, "approxTokens": 370,"headings": ["Attention Is All You Need"], "startChar": 0, "endChar": 1480, "pageStart": 1, "pageEnd": 1}
A failed document still produces an item, so you can match inputs to outputs:
{"url": "https://example.com/broken.pdf", "status": "failed", "errorCode": "CORRUPT_FILE","error": {"code": "CORRUPT_FILE", "message": "PDF could not be opened: …", "retryable": false},"charged": {"document-converted": 0, "ocr-page": 0}}
The OUTPUT record in the key-value store holds the run totals: total, succeeded, partial, failed, ocrPages, characters and stoppedByBudget.
Status values
success: fully converted.partial: converted with something missing, for example OCR stopped by your max run cost or a per-document timeout. The text that was extracted is returned and charged as one document.failed: nothing usable was extracted. Never charged.
Error codes (errorCode, document not charged)
| Code | Meaning | Retry? |
|---|---|---|
INVALID_INPUT / INVALID_URL | Empty entry, not http(s), or credentials in the URL | no |
BLOCKED_URL | Resolves to a private, loopback, link-local or cloud-metadata address (SSRF protection) | no |
DNS_ERROR | The hostname does not resolve | maybe |
DOWNLOAD_FAILED / DOWNLOAD_TIMEOUT | Network or TLS error, too many redirects, or too slow | yes |
NOT_FOUND | HTTP 404/410, or the key-value store record does not exist | no |
ACCESS_DENIED | The run cannot read that key-value store: pick it in the Key-value store field so read access is granted | no |
HTTP_ERROR | Any other non-2xx response (retryable: true for 408/429/5xx) | see flag |
FILE_TOO_LARGE / EMPTY_FILE | Bigger than maxFileSizeMb, or 0 bytes | no |
UNSUPPORTED_FORMAT | For example legacy .doc, .xls, ZIP or video | no |
CORRUPT_FILE / ENCRYPTED_PDF | Cannot be parsed, or password-protected | no |
TOO_MANY_PAGES | Above the 2,000-page hard limit | no |
CONVERSION_TIMEOUT / CONVERSION_FAILED | The converter ran out of time before any output, or failed unexpectedly | maybe |
NO_TEXT_FOUND | Nothing extractable (for example a scan with ocrMode: never) | no |
BUDGET_EXCEEDED | Your Maximum cost per run was reached before this document | yes, with a higher limit |
Warning codes (warnings[].code)
PAGES_TRUNCATED, OCR_SKIPPED_OCR_MODE_NEVER, OCR_LIMITED_BY_BUDGET, OCR_PAGE_FAILED, OCR_LOW_CONFIDENCE (mean below 60), OCR_LANGUAGE_UNSUPPORTED, TIMEOUT_PARTIAL_OUTPUT, CONTENT_TRUNCATED_IN_DATASET (the full file is still in outputFileUrl), CHUNKS_MOVED_TO_KEY_VALUE_STORE (see chunksUrl), IMAGES_REMOVED, LOW_TEXT_YIELD.
How much does it cost to convert PDF to Markdown?
Pay per event:
| Event | Price | When |
|---|---|---|
apify-actor-start | $0.00005 | Once per run, per GB of memory (default 1 GB) |
document-converted | $0.003 | Each document converted (success or partial). Failed documents are free. |
ocr-page | $0.01 | Each page or image actually run through OCR. Pages with a text layer are free. |
There is no separate charge for platform compute. Worked examples:
| Job | Calculation | Cost |
|---|---|---|
| The default input (1 PDF + 1 web page) | 2 × $0.003 | $0.006 |
| 1,000 digital PDFs, DOCX or HTML files | 1,000 × $0.003 | $3.00 |
| 1,000 single-page scanned invoices (JPG or scanned PDF) | 1,000 × ($0.003 + $0.01) | $13.00 |
| One 300-page digital PDF | page count doesn't matter with a text layer | $0.003 |
One 50-page scanned PDF with maxPages: 10 | $0.003 + 10 × $0.01 | $0.103 |
Set Maximum cost per run in the run options to cap spend. The Actor reserves budget before each OCR page, never charges beyond your limit, and marks what it skipped (OCR_LIMITED_BY_BUDGET or BUDGET_EXCEEDED).
Limits
- File size: 50 MB by default, 100 MB maximum. Pages per document: 2,000 maximum. Timeout per document: 600 s by default, 3,600 s maximum.
- Up to 10,000 URLs per run, and up to 1,000 records per key-value store.
- OCR renders pages at about 300 DPI, capped at 40 MP per page, at roughly 1 page per second with the default 1 GB memory. Use 2–4 GB for large OCR batches.
- Dataset items larger than about 8 MB keep the full content only in the key-value store file (with a warning).
- Not supported: legacy binary
.doc/.xls/.ppt, PPTX and XLSX, handwriting, and math formula reconstruction. Images inside documents are dropped (alt text is kept). PDF tables without ruling lines come out as text in reading order, not as Markdown tables. - Only public URLs are fetched. Private network and cloud-metadata addresses are blocked on every redirect hop.
How it compares
| This Actor | Typical alternatives on the Store | |
|---|---|---|
| Price per digital document | $0.003, any page count | Two other PDF converter Actors checked on 31 Oct 2026: $0.005 per PDF plus a $0.005 start fee, and $0.02 per PDF plus $0.001 per page |
| OCR | $0.01 per OCR'd page, only on pages with no usable text layer | $0.015 per OCR page in the first of those two |
| Formats | PDF, scans, images, DOCX, ODT, RTF, EPUB, HTML, TXT | Often PDF-only or images-only |
| Failures | Per-document error codes, free, never fail the run | Often a generic error or a failed run |
| RAG | Heading-aware chunks with page ranges | Often absent or fixed-size |
FAQ
What happens when a file fails? That document gets status: "failed", an errorCode from the table above and a retryable flag, and it is not charged. The other documents keep going, and the run still succeeds. An input with no documents at all fails straight away with an Input error message.
What are the limits? 50 MB per file by default (100 MB maximum), 2,000 pages per document, 600 s per document by default, 10,000 URLs per run. See Limits. Use maxPages to convert only the first pages of large scans.
Can I schedule it or watch a folder? There is no built-in monitor mode. Each run converts the documents you give it. For recurring jobs, create an Apify Schedule or Task that points at a key-value store or URL list, or trigger runs from a webhook in your own pipeline.
Where do the documents come from, and is it legal? Only from the URLs, uploads or key-value stores you supply. The Actor does not crawl or search the web. You are responsible for having the right to process the files. Your data is processed inside your own Apify run, kept only in that run's storage under your account's retention settings, and not used for training.
Which output formats do I get? Markdown (default) or plain text, inline in the dataset (JSON, CSV, Excel, XML or RSS export) and as a .md/.txt file per document. RAG chunks are optional.
Does it integrate with my stack? Yes: the Apify API and SDKs (Python, JavaScript), run-sync-get-dataset-items for one-call conversion, webhooks, Zapier, Make, n8n, LangChain and LlamaIndex Apify loaders, and the Apify MCP server for AI agents. It is pay-per-event only, needs limited permissions and has no Standby.
Why did a PDF use OCR, and how good is it? In auto mode, a page is OCR'd only when it has no text layer, almost no text, or garbled text (broken font encodings). Tesseract 5 handles Portuguese accents (ç, ã, é) well on clean scans (about 95% mean confidence on our test invoices). Low-quality photos get the OCR_LOW_CONFIDENCE warning. Use ocrMode: never to turn OCR off.
Are tables preserved? Which licences are used? Tables in DOCX, ODT, HTML and EPUB become GitHub pipe tables (merged cells are flattened). PDF tables are detected where ruling lines exist; otherwise their text is kept in reading order. Only permissive open-source tools run in-process (pdfminer.six, pdfplumber, pypdfium2, Pillow, httpx, Tesseract). Pandoc (GPL-2.0+) runs as a separate, unmodified program. No AGPL components. See NOTICE.md.
Other Actors by Haniel
- SAM.gov Scraper: Contract Opportunities & Contacts, No Login: New SAM.gov contract opportunities, RFPs and sources sought by NAICS, set-aside and agency. No API key. $2 per 1,000 notices.
- Consulta CNPJ em Lote: Brazil CNPJ Lookup (Receita Federal): Bulk Brazil CNPJ lookup: legal name, CNAE, partners (QSA), address, Simples Nacional and MEI. $1.20 per 1,000 companies.
- Greenhouse, Lever & Ashby Jobs Scraper API: New Job Alerts: Search jobs by keyword across about 500 tech companies or by company, with a monitor mode that returns only new postings. $1.50 per 1,000 jobs.
- Floor Plan Takeoff: PDF Room Areas, Wall LF & Door Counts: Construction takeoff from vector floor-plan PDFs: room SF, wall linear feet, door counts and a check overlay. $2.50 per measured sheet.