PDF to Markdown, Text & Tables for LLMs avatar

PDF to Markdown, Text & Tables for LLMs

Pricing

from $2.00 / 1,000 pdf processeds

Go to Apify Store
PDF to Markdown, Text & Tables for LLMs

PDF to Markdown, Text & Tables for LLMs

Convert PDF URLs into LLM-ready Markdown with every table as structured cells (Markdown/CSV/JSON, with page numbers) and page-aware RAG chunks. Text-layer PDFs, no OCR.

Pricing

from $2.00 / 1,000 pdf processeds

Rating

0.0

(0)

Developer

frank zhang

frank zhang

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

12 days ago

Last modified

Features

Limited permissions

Share

Turn any public PDF URL into LLM-ready Markdown with every table returned as structured cells (Markdown, CSV or JSON, one entry per table with its page number) and optional page-aware RAG chunks (pageStart/pageEnd on every chunk). Built for RAG pipelines, AI agents and document-processing workflows that need the numbers in a table, not a flattened blob of text.

Why this Actor

  • Tables as data, not text. Ruled grids and booktabs-style (LaTeX/arXiv) tables come out as rows and columns you can load straight into a dataframe or a prompt. On a hand-checked test set of 10 public PDFs (68 tables), precision is 0.92 and recall 0.82.
  • Chunks that know their pages. Each RAG chunk carries its page span, so answers can cite "page 12" back to the source.
  • Clean text around the tables. Two-column reading order, headings, and running headers and footers removed.

It uses the PDF's text layer only: no OCR, no AI calls, no proxies.

What does it do?

  • Downloads each PDF (http/https, up to 50 MB by default) and extracts the text layer.
  • Keeps reading order on two-column pages (papers, government publications) and turns large or bold lines into # / ## / ### headings.
  • Detects ruled tables and booktabs-style tables (common in arXiv/LaTeX papers) and writes them inline as Markdown tables, plus a structured tables array in your chosen format.
  • Strips repeated running headers and footers (page numbers, document titles, "VerDate … Jkt" print lines) by default; set removeHeadersFooters to false to keep them.
  • Removes rotated margin stamps (for example, the arXiv sidebar), repairs end-of-line hyphenation and fixes duplicated "faux-bold" characters.
  • Optional chunking: produces one dataset item per ~N-character chunk, with overlap, pageStart/pageEnd and chunk index, ready to embed.
  • Never fails the whole run on a bad file. A broken URL, non-PDF, oversized, encrypted or scanned PDF becomes an error item with an errorCode.
  • Respects your spending limit. If the remaining budget cannot pay for a whole PDF, the Actor keeps only the leading pages it can pay for and marks the item truncated: true, truncatedReason: "budget". You are never given output you were not charged for, and never charged past your limit.

Input

FieldTypeDefaultDescription
pdfUrlsarray (required)–PDF URLs, e.g. [{"url": "https://arxiv.org/pdf/2310.06825"}]
outputFormatmarkdown | text | jsonmarkdownjson returns one entry per page (markdown, text, tables)
extractTablesbooleantrueDetect tables (each one billed as table-extracted)
tableFormatmarkdown | csv | jsonmarkdownFormat of tables[].data
pageRangestringalle.g. "1-5,9" or "10-"
maxPagesPerPdfinteger200Hard cap on pages per PDF
chunkingobjectoff{"enabled": true, "chunkSizeChars": 2000, "overlapChars": 200}
includeMetadatabooleantrueTitle, author, producer, dates, page count
maxFileSizeMbinteger50Larger files are rejected (FILE_TOO_LARGE)
removeHeadersFootersbooleantrueDrop lines that repeat in the top/bottom margin on many pages (running headers, footers, page numbers)

Example input:

{
"pdfUrls": [{ "url": "https://arxiv.org/pdf/2310.06825" }],
"outputFormat": "markdown",
"extractTables": true,
"tableFormat": "csv",
"chunking": { "enabled": false }
}

Output

One dataset item per PDF (or one per chunk when chunking is on). This is a real, shortened result for the Mistral 7B paper (arXiv 2310.06825, CC BY 4.0):

{
"url": "https://arxiv.org/pdf/2310.06825",
"status": "success",
"fileName": "2310.06825",
"pageCount": 9,
"pagesProcessed": 9,
"truncated": false,
"failedPages": [],
"tableCount": 5,
"charCount": 25921,
"markdown": "# Mistral 7B\n\nAlbert Q. Jiang, Alexandre Sablayrolles, ...\n\n### Abstract\n\nWe introduce Mistral 7B, a 7–billion-parameter language model ...\n\n| Parameter | Value |\n| --- | --- |\n| dim | 4096 |\n| n_layers | 32 | ...",
"tables": [
{ "tableIndex": 1, "page": 2, "rows": 10, "columns": 2, "format": "markdown", "data": "| Parameter | Value |\n| --- | --- |\n| dim | 4096 | ..." }
],
"metadata": { "title": null, "producer": "pdfTeX-1.40.25", "creationDate": "D:20231011004817Z", "pageCount": 9 },
"processingMs": 1047,
"chargedEvents": { "pdf-processed": 1, "table-extracted": 5 }
}

Error item (you are told why, and the run continues):

{ "url": "https://example.com/scan.pdf", "status": "error", "errorCode": "NO_TEXT_LAYER",
"errorMessage": "Only 0 text characters found in 3 page(s). The PDF looks scanned or image-only; OCR is not supported by this Actor.",
"chargedEvents": { "invalid-input": 1 } }

Error codes and billing:

Charged as invalid-input ($0.0005), a problem with the inputNot charged, not your fault
INVALID_URL, DOWNLOAD_FAILED (HTTP 403, 404 or other 4xx), NOT_A_PDF, FILE_TOO_LARGE, ENCRYPTED_PDF, CORRUPT_PDF, EMPTY_PDF, INVALID_PAGE_RANGE, NO_TEXT_LAYERSERVER_ERROR (HTTP 5xx, 408, 425, 429 after 3 attempts), TIMEOUT, NETWORK_ERROR (after 3 attempts), INTERNAL_ERROR (a bug on our side)

Each item also has truncatedReason (null, maxPagesPerPdf or budget) and headerFooterLinesRemoved.

A run summary is saved to the key-value store as OUTPUT_SUMMARY.

Pricing (pay per event)

You pay only for results. There is no monthly fee.

EventPriceWhen
PDF processed$0.002Each PDF converted successfully. Covers up to 20 pages.
Extra page$0.0002Each processed page above 20 in one PDF
Table extracted$0.001Each detected table (turn off extractTables to skip)
Invalid input$0.0005Only for input problems: bad URL, HTTP 4xx (403/404), not a PDF, too large, encrypted, corrupt, empty, bad page range, or scanned (no text layer). Server errors (5xx), timeouts, network failures and our own errors are free.

Examples: a 9-page paper with 5 tables costs $0.007. A 59-page IRS publication with 11 tables costs $0.0208. 1,000 ten-page PDFs without tables cost $2. Chunks and dataset items are free. There is no start fee. The Actor stops when it reaches your maximum cost per run.

Limits

  • No OCR. Scanned or image-only PDFs return NO_TEXT_LAYER.
  • Tables must be drawn with lines (full grid or booktabs-style top/mid/bottom rules). Whitespace-only tables are kept as text. Multi-line cells in partly ruled grids may be merged. Sparse boxes (chart panels, cover-page frames) are filtered out, but some chart grids can still appear as tables. Tables whose row labels sit outside the ruled area can lose that label column.
  • Heading detection uses font size and boldness, so very unusual layouts may produce extra or missing headings. Header/footer removal needs the line to repeat on at least 3 pages (and 30% of pages), so short documents keep theirs.
  • Two-column layout is supported. Three or more columns, or rotated pages, may interleave.
  • Public URLs only (no login, no cookies). Defaults are 50 MB and 200 pages per PDF. Memory is 512 MB–1 GB, and a 1,500-page file can take several minutes.
  • Pure-Python, permissively licensed stack: pdfplumber and pdfminer.six (MIT), httpx (BSD) and the Apify SDK (Apache-2.0). No AGPL components.

FAQ

Why Markdown? LLMs understand headings and tables in Markdown better than raw PDF text, and it uses fewer tokens than HTML.

Can I feed the output straight into a vector DB? Yes. Turn on chunking and each item has content, chunkIndex, pageStart and pageEnd.

My PDF is behind a login. Not supported. Upload it somewhere public (for example, an Apify key-value store record with a public URL) and pass that URL.