PDF to Markdown with OCR for RAG and LLMs
Pricing
from $0.80 / 1,000 page converteds
PDF to Markdown with OCR for RAG and LLMs
Convert PDFs, including scanned ones, to clean Markdown for RAG and LLMs. Keeps headings, lists, tables and two-column reading order, reads scanned pages with OCR, and returns token-sized chunks with heading paths and page numbers.
Pricing
from $0.80 / 1,000 page converteds
Rating
0.0
(0)
Developer
Aditya
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
3 days ago
Last modified
Categories
Security
Limited permissionsShare
Convert PDFs into clean Markdown and RAG-ready chunks. This includes scanned PDFs, which are read with OCR.
- Scanned pages are read, not refused. Pages that are images without
a text layer go through OCR (Tesseract):
- JBIG2 and JPEG 2000 scans are supported;
- text pages use their exact text layer instead;
- mixed PDFs get both, page by page.
- Structure kept:
- headings are detected from font sizes (
#,##,###); - bulleted and numbered lists become Markdown lists, including bullets drawn as graphics;
- words hyphenated across a line break are joined;
- superscript footnote marks stay on their line.
- headings are detected from font sizes (
- Tables become Markdown tables.
- Columns come from the layout, so right-aligned numbers, empty cells and headers spanning several columns are handled.
- A table that continues on the next page stays one table.
- In chunks, large tables are split between rows, with the header row repeated in every piece.
- Code listings become fenced code blocks (monospace text).
- Two-column layouts are read column by column. Academic papers and brochures come out in reading order, not interleaved line by line.
- Chunks for retrieval:
- each chunk stays within one section and never crosses a heading;
- each carries its heading path (for example
Report > Shipping), its page range and its token count (GPT tokenizer, configurable maximum).
- Upload or link: pass public URLs, or upload PDFs from your computer.
- Page ranges: convert only
1-5,8if that is all you need.
Use cases
- RAG and LLM ingestion: turn PDFs into chunks that keep their section context, ready for embedding in a vector database.
- Scanned archives: make old scanned reports, letters and manuals searchable text.
- Research papers: convert two-column papers into Markdown in reading order, with their tables.
- Reports and statements: extract tables of figures as Markdown tables.
Pricing
Pay per event. Platform usage is included. Higher Apify discount tiers pay less: down to $0.0008 per text page and $0.0035 per OCR page (see the Pricing tab).
| Event | Price |
|---|---|
| Page converted from its text layer | $0.001 |
| Page read by OCR (scanned) | $0.005 |
| Blank pages, failed downloads, password-protected or invalid files, files with no text | free |
A 20-page text PDF costs $0.02. A 20-page scan costs $0.10. Your spending
limit is respected: OCR stops when the limit is reached, and remaining
pages are listed in scannedPagesNotRead.
Input
| Field | Meaning |
|---|---|
pdfUrls | Public PDF URLs, up to 50 MB each |
pdfFiles | PDFs uploaded from your computer |
pages | Optional page selection, e.g. 1-5,8 |
ocr | auto (scanned pages only, default), always (every page; for garbled text layers) or off |
ocrLanguages | Languages of scanned text, e.g. ["eng", "deu"] (default English; 29 available) |
chunking | Return RAG chunks (default true) |
chunkMaxTokens | Maximum tokens per chunk, 100–4000 (default 500) |
Output
One dataset item per PDF:
{"url": "https://example.com/report.pdf","title": "Quarterly Operations Report","pageCount": 12,"pagesConverted": 12,"textPages": 10,"ocrPages": 2,"ocrConfidence": 91,"markdownUrl": "https://api.apify.com/v2/key-value-stores/…/records/document-1.md","markdown": "# Quarterly Operations Report\n\n…","chunks": [{ "headings": ["Quarterly Operations Report", "Shipping performance"], "pageFrom": 1, "pageTo": 2, "tokens": 412, "text": "…" }]}
ocrConfidence is Tesseract's mean confidence (0–100) over the OCR pages.
Below about 70, check the scan quality.
FAQ
Does it work on scanned PDFs? Yes. Pages without a text layer are read
with OCR automatically (ocr: auto). You pay the OCR price only for those
pages.
Which languages does OCR support? 29, including English, German,
French, Spanish, Portuguese, Italian, Dutch, Polish, Russian, Arabic,
Hindi, Chinese, Japanese and Korean. Pick them in ocrLanguages. Pages
with a text layer need no language setting.
How do I use the output in a RAG pipeline? Take chunks from each
dataset item. Each chunk's text is ready to embed. Store headings,
pageFrom and pageTo as metadata, to cite sources.
Can I call it from code? Yes, through the Apify API or the Apify clients for JavaScript and Python (see the API tab), or from AI agents through Apify's MCP server.
What does it cost for a whole document? Pages × price: a 50-page text PDF costs $0.05. Set a maximum cost per run in the run options to cap spending.
Speed
- Text pages take milliseconds.
- OCR takes a few seconds per page and grows with the amount of text. A dense letter-size page took about 8 seconds at the default 2 GB in tests on Apify.
- More memory gives more CPU (one core per 4 GB): use 4 GB for large scanned documents.
Limits
- Tables:
- a cell that wraps onto a second line becomes its own row;
- the first row is always the header;
- tables in scans work when their columns are clearly spaced.
- OCR:
- reads upright pages; sideways pages are not rotated;
- handwriting is not supported;
- bold section headings in a scan that are no larger than the body text stay in the paragraph.
- Layouts:
- three or more columns are read as one;
- right-to-left scripts (Arabic, Hebrew) may come out with words in reverse order.
- Vector text: text drawn as vector shapes (no text layer and no
image) is found only with
ocr: always. - Support: report problems in the Issues tab. Fixes ship as new Actor versions.
Built with pdf.js (Apache-2.0), tesseract.js (Apache-2.0) with Tesseract's trained data (Apache-2.0), and gpt-tokenizer (MIT).