PDF to Markdown & Text for LLM/RAG (OCR, Tables, Chunks) avatar

PDF to Markdown & Text for LLM/RAG (OCR, Tables, Chunks)

Pricing

from $1.00 / 1,000 pdf page extracteds

Go to Apify Store
PDF to Markdown & Text for LLM/RAG (OCR, Tables, Chunks)

PDF to Markdown & Text for LLM/RAG (OCR, Tables, Chunks)

Convert PDFs (URLs or uploaded files) to clean Markdown and text with GitHub tables, per-page metadata and token-sized chunks for RAG and AI agents. Optional Tesseract OCR for scanned pages (English, Spanish and more) and a Mexican CFDI invoice mode. Pay per page. By IntegriApps.

Pricing

from $1.00 / 1,000 pdf page extracteds

Rating

0.0

(0)

Developer

IntegriApps .com

IntegriApps .com

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Security

Limited permissions

Share

Convert PDF files to clean Markdown and plain text ready for LLMs, RAG pipelines, embeddings, vector databases and AI agents. Give it PDF links or upload your files: every document comes back with Markdown tables, headings, per-page metadata, document metadata and token-sized chunks with page numbers. Scanned or image-only pages can be read with Tesseract OCR (English, Spanish, Portuguese, French, German, Italian, Hindi). A special CFDI mode pulls the key fields out of Mexican invoice PDFs.

Part of IntegriApps MicroApps. Support Sunday to Friday.

What it does

  • PDF → Markdown: headings (detected from font size), paragraphs (wrapped lines are joined, hyphenated words repaired), bullet and numbered lists, and ruled tables as GitHub-flavored Markdown tables.
  • Multi-column layouts: two- and three-column pages (papers, IRS publications, brochures) are read column by column instead of mixing lines across columns.
  • Per-page metadata: page number, size, extraction method (text, ocr or empty), OCR confidence, tables, images, characters and words per page.
  • Document metadata: title, author, subject, keywords, creator, producer, creation and modification dates, page count, file size and SHA-1.
  • RAG-ready chunks: the document is split into chunks of ~N tokens (1 token ≈ 4 characters) on block boundaries, with overlap, start/end page and the nearest heading.
  • OCR for scanned PDFs: auto mode runs Tesseract only on pages without a text layer, so normal PDFs stay cheap and fast; always mode OCRs every page.
  • CFDI mode (Mexico): detects UUID (folio fiscal), RFC emisor and receptor, subtotal, total, issue and certification dates, currency, CFDI type, series/folio, SAT certificate number, uso CFDI, método and forma de pago in printed CFDI 4.0 invoices.
  • Three input options: PDF URLs, files uploaded in the input form, or every PDF in one of your key-value stores (bulk).
  • Safe by design: downloads only the files you give it (no crawling), retries network errors with backoff, skips files over your size limit, and never charges for failed or non-PDF files.

Use cases

  • Load manuals, contracts, reports, papers or policies into a RAG chatbot or vector database (Pinecone, Qdrant, pgvector, Weaviate, Chroma…).
  • Give an AI agent / MCP client a tool that reads a PDF and returns Markdown.
  • Make scanned documents searchable with OCR.
  • Pull invoice data from Mexican CFDI PDFs when you don't have the XML (accounting, expense control, reconciliation).
  • Bulk-convert a folder of PDFs exported by another Actor or uploaded via the API.

Input

FieldDescriptionDefault
pdfUrlsDirect links to PDF files—
filesUpload PDFs (stored in an Apify key-value store) or paste file URLs—
keyValueStoreIdPick a key-value store: all its PDF records are processed (read-only access to that store only)—
keyPrefixOnly process records whose key starts with this prefix—
ocrModeauto (OCR only pages without text), off, alwaysauto
ocrLanguagesTesseract languages: eng, spa, por, fra, deu, ita, hin["eng","spa"]
ocrDpiOCR rendering resolution (100–400)300
cfdiModeDetect Mexican CFDI invoice fieldsfalse
extractTablesRuled tables as Markdown tablestrue
chunkSize / chunkOverlapChunk size and overlap in tokens (0 = no chunks)800 / 100
pageMarkers<!-- page N --> comments between pagestrue
includePlainTextAlso return text without page markersfalse
maxPagesPerPdfOnly the first N pages are processed and charged (0 = all, up to 5,000)500
maxFileSizeMbLarger files are skipped, not charged (1–200)50
passwordPassword for encrypted PDFs (stored encrypted)—
maxConcurrencyPDFs processed in parallel (1–4)2

Empty input converts a small bundled sample PDF for free, so you can see the output format.

Example — two PDFs, OCR only where needed, smaller chunks:

{
"pdfUrls": [
{ "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf" },
{ "url": "https://arxiv.org/pdf/1706.03762" }
],
"ocrMode": "auto",
"chunkSize": 500,
"chunkOverlap": 50
}

Output

One dataset item per PDF. Real output of the free demo run (shortened):

{
"source": "sample.pdf",
"status": "ok",
"fileSizeBytes": 3176,
"metadata": { "title": "Quarterly Report", "author": "IntegriApps Test", "producer": "ReportLab PDF Library - (opensource)", "createdAt": "2026-11-02T11:10:14-06:00" },
"pageCount": 2,
"pagesProcessed": 2,
"truncated": false,
"ocrPages": 0,
"tableCount": 1,
"wordCount": 305,
"tokenEstimate": 463,
"markdown": "<!-- page 1 -->\n\n# Quarterly Report 2026\n\n## 1. Summary\n\nRetrieval augmented generation works best when ...\n\n- Revenue grew 12%\n- Costs fell 3%\n- New customers: 41\n\n## 2. Sales by region\n\n| Region | Q1 | Q2 | Total |\n|---|---|---|---|\n| North | 1,200 | 1,350 | 2,550 |\n| South | 980 | 1,010 | 1,990 |\n| Online | 2,400 | 2,900 | 5,300 |\n\nNumbers are in thousands of USD.\n\n<!-- page 2 -->\n\n## 3. Outlook\n\n...",
"pages": [
{ "pageNumber": 1, "width": 612, "height": 792, "extraction": "text", "layoutSegments": 1, "tableCount": 1, "imageCount": 0, "charCount": 901, "wordCount": 161 },
{ "pageNumber": 2, "width": 612, "height": 792, "extraction": "text", "layoutSegments": 1, "tableCount": 0, "imageCount": 0, "charCount": 914, "wordCount": 144 }
],
"chunks": [
{ "index": 0, "text": "# Quarterly Report 2026\n\n## 1. Summary\n\n...", "tokens": 455, "pageStart": 1, "pageEnd": 2, "heading": "Quarterly Report 2026" }
]
}

Real cfdi object from a sample invoice with SAT test data (cfdiMode: true):

"cfdi": {
"isCfdi": true,
"uuid": "6F8A1C2E-3B4D-4E5F-9A0B-1C2D3E4F5A6B",
"rfcEmisor": "EKU9003173C9",
"rfcReceptor": "XAXX010101000",
"subtotal": 1000,
"total": 1160,
"fechaEmision": "2026-10-15T10:22:31",
"fechaTimbrado": "2026-10-15T10:23:02",
"moneda": "MXN",
"tipoComprobante": "I",
"serie": "A",
"folio": "1024",
"noCertificadoSat": "30001000000500003456",
"usoCfdi": "S01",
"metodoPago": "PUE",
"formaPago": "03",
"fieldsFound": 15
}

Fields that are not found are null.

status is one of ok, not_a_pdf, invalid_pdf, password_protected, download_error, file_too_large, error, charge_limit_reached or skipped_charge_limit. Only processed pages of ok documents are charged. The key-value store also gets a RUN_SUMMARY record (documents, pages, OCR pages, charged pages). Export the dataset as JSON, JSONL, CSV or Excel, or use the CFDI dataset view for a flat invoice table.

Pricing

Pay per event, per page:

EventPriceWhen
page-extractedUSD 0.001 per page (USD 1 per 1,000 pages)A page converted from its text layer
ocr-pageUSD 0.004 per page (USD 4 per 1,000 pages)A page read with OCR (instead of page-extracted)

Chunks, metadata, tables and CFDI mode are included. Not charged: blank pages, pages where OCR finds no text, failed downloads, non-PDF files, encrypted PDFs without the right password and files over your size limit. Apify also adds its small standard Actor-start fee. Examples: a 10-page text PDF costs USD 0.01; a 10-page scan costs USD 0.04. Use maxPagesPerPdf and the run's maximum charge setting to cap spending — the Actor stops cleanly at the limit.

Use it from your code

curl -X POST "https://api.apify.com/v2/acts/integriapps~pdf-to-markdown/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"pdfUrls":[{"url":"https://www.irs.gov/pub/irs-pdf/fw9.pdf"}],"chunkSize":0}'

It also works from the Apify API clients (JavaScript/Python), Make, Zapier, n8n, LangChain/LlamaIndex Apify integrations and the Apify MCP server.

FAQ

Which tables are converted to Markdown tables? Tables drawn with lines (ruled cells), as in invoices, forms and most business reports. Borderless tables (for example many academic papers) come out as text lines in reading order.

How good is the OCR? It uses Tesseract 5, which works well on clean scans at 300 DPI (the per-page ocrConfidence tells you how sure it was). Handwriting, very low-resolution or skewed scans give poor results. OCR output is plain paragraphs (no table detection on scanned pages).

Does it handle multi-column PDFs? Yes, columns of prose are read one after the other. Very complex layouts (magazines, mixed boxes and sidebars) may still come out partly out of order.

Is the CFDI mode a validation against the SAT? No. It reads the printed invoice text with heuristics and returns what it finds; it does not verify the invoice status with the SAT or check the digital seal. When the data matters, use the CFDI XML (for example with our CFDI 4.0 Parser & Validator Actor).

Can it open password-protected PDFs? Yes, if you give the password in password. Otherwise the item gets password_protected and is not charged.

Can it read PDFs behind a login? No. Give it public links, signed links, uploaded files or a key-value store you select. The Actor runs with limited permissions and only reads the store you pick.

Is my data stored somewhere else? No. Files are processed in memory inside your run; results are saved only in your run's dataset and key-value store.

How are tokens counted? As an estimate of 4 characters per token, close to common LLM tokenizers for English text.

Changelog

See ./CHANGELOG.md.

Part of IntegriApps MicroApps — small tools by IntegriApps, a SaaS for SMBs. Support Sunday to Friday.