PDF to Markdown - Text, Tables, CJK-safe avatar

PDF to Markdown - Text, Tables, CJK-safe

Pricing

from $3.00 / 1,000 pdf converted (up to 50 pages)s

Go to Apify Store
PDF to Markdown - Text, Tables, CJK-safe

PDF to Markdown - Text, Tables, CJK-safe

PDF URLs to RAG-ready Markdown, text or chunks with page refs. Headings, lists, tables, header/footer removal, Korean/Japanese/Chinese safe. $0.003 per PDF up to 50 pages, only when it works. No OCR: scans are flagged, free.

Pricing

from $3.00 / 1,000 pdf converted (up to 50 pages)s

Rating

0.0

(0)

Developer

도영 김

도영 김

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

20 hours ago

Last modified

Features

Limited permissions

Share

Turn PDF URLs into RAG-ready Markdown, plain text, or token-sized chunks with page references. The Actor reads the text layer of each PDF with Mozilla's PDF.js, puts it back into reading order (two-column pages included), and rebuilds headings, lists, paragraphs and simple tables. Korean, Japanese and Chinese PDFs are decoded with PDF.js's bundled CMaps, and every row carries a garbledRatio so you can see when text did not come out clean.

  • Pay only when it worked. $0.003 per PDF with status ok, covering up to 50 pages. Failed, empty, encrypted and scanned PDFs are saved as rows and not charged.
  • Honest about what it cannot do. There is No OCR. A page without a text layer is reported (pagesWithoutText, scannedLikely), never guessed. A PDF where no page has text gets status no_text and is free.
  • Made for RAG. outputMode: "chunks" splits the Markdown into chunks of about chunkSize tokens, each with pageStart, pageEnd and the headingPath it sits under.
  • Plain HTTP. No browser, no proxy, no third-party conversion service. The PDF is parsed inside the run and is not sent anywhere else.

Who it is for

  • Developers building RAG, search or agents over PDFs, including Korean, Japanese and Chinese government and corporate documents
  • Teams that need a quality signal per document (garbledRatio, scannedLikely, per-page character counts) to route bad files to OCR or a human
  • Anyone who wants metadata (title, author, page count, created, producer) next to the text

Input

{
"urls": [
"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
"https://arxiv.org/pdf/1706.03762"
],
"outputMode": "chunks",
"chunkSize": 800,
"pageRange": "1-5",
"maxPages": 50
}
FieldTypeDefaultNotes
urlsstring[]required1 to 500 public http(s) URLs. Redirects are followed.
outputModestringmarkdownmarkdown, text or chunks. Same price for all.
chunkSizeinteger800100 to 4000 estimated tokens per chunk. Used only for chunks.
pageRangestringallFor example 1-5,8,10-.
maxPagesinteger501 to 1000. See pricing: pages beyond 50 cost extra.
maxFileSizeMbinteger301 to 100. Larger files get too_large.
includePagesbooleanfalseAdds pages[] with the plain text of each page.
removeHeadersFootersbooleantrueDrops lines in the top or bottom margin that repeat on at least 40% of the pages (3 or more pages). Bare page numbers in the margin are always dropped.
detectTablesbooleantrueAligned columns of text become Markdown tables.
pageMarkersbooleanfalseAdds <!-- page N --> comments to the Markdown.
timeoutPerPdfSecsinteger12010 to 600. Download and conversion of one PDF.
maxConcurrencyinteger21 to 4 downloads at once. Parsing runs one PDF at a time.

URL rules

Only http and https URLs on the default ports are fetched. URLs with a user name and password, custom ports, localhost, internal host names, or addresses in private, loopback, link-local and cloud-metadata ranges are refused with INVALID_URL or UNSAFE_ADDRESS. The check runs on every redirect and on the resolved IP address, so a public name that points to a private address is refused as well. The file type is decided by the %PDF- signature, not by the extension or the Content-Type header.

Output

One dataset row per input URL, in the order the conversions finish (use index for the input order). Example (shortened):

{
"index": 0,
"url": "https://example.com/report.pdf",
"finalUrl": "https://example.com/report.pdf",
"status": "ok",
"reason": null,
"charged": true,
"extraPageBlocks": 0,
"title": "Annual Findings",
"author": "Test Author",
"createdAt": "2007-02-23T15:56:37.000Z",
"producer": "OpenOffice.org 2.1",
"pageCount": 3,
"pagesProcessed": 3,
"truncated": false,
"scannedLikely": false,
"pagesWithoutText": [],
"garbledRatio": 0,
"headingCount": 5,
"tableCount": 1,
"listCount": 2,
"removedHeaderFooterLines": 6,
"charCount": 438,
"tokensEstimate": 89,
"pageStats": [{ "page": 1, "chars": 357, "hasText": true, "columns": 1, "garbledRatio": 0 }],
"warnings": [],
"markdown": "# Annual Findings\n\n## Overview\n\nThis report describes ...\n\n| Region | Units | Revenue |\n| --- | --- | --- |\n| North | 120 | 4,500 |",
"durationMs": 312
}

With outputMode: "chunks" the markdown field is null and chunks holds objects like:

{ "index": 3, "text": "## Results\n\n| Region | ...", "tokensEstimate": 212, "pageStart": 2, "pageEnd": 2, "headingPath": ["Annual Findings", "Results"] }
FieldMeaning
status, reasonSee the status table below. reason is null for ok.
chargedtrue only for ok rows.
extraPageBlocksNumber of extra-pages-10 blocks charged for this PDF (0 unless you raised maxPages above 50).
title, author, subject, keywords, creator, producer, createdAt, modifiedAtFrom the PDF information dictionary. Dates are ISO 8601. null when the file has none.
pageCountPages in the PDF. pagesProcessed is how many were converted. truncated is true when maxPages or the budget cut the document short.
scannedLikelytrue when at least half of the processed pages have no text layer. pagesWithoutText lists them.
garbledRatioShare of non-space characters that are replacement characters, private-use code points or control characters (0 to 1). A value above 0.02 adds the warning GARBLED_TEXT_SUSPECTED.
headingCount, tableCount, listCountBlocks found.
removedHeaderFooterLinesMargin lines dropped as repeated headers, footers or page numbers.
charCount, tokensEstimateSize of the text. Tokens are estimated (4 Latin characters, or 1 Korean, Japanese or Chinese character, per token), not counted with a specific tokenizer.
pageStatsPer page: chars, hasText, columns (1 or 2), garbledRatio.
warningsPAGE_LIMIT_REACHED, BUDGET_LIMITED_PAGES, PAGES_WITHOUT_TEXT_LAYER, GARBLED_TEXT_SUSPECTED, ROTATED_TEXT_SKIPPED, PAGE_UNREADABLE, PAGES_FIELD_DROPPED_ROW_TOO_LARGE, OUTPUT_SAVED_TO_KEY_VALUE_STORE.
markdown, text, chunks, pagesThe requested content.
outputRecordKeyNormally null. A row larger than about 8 MB moves its content to the run's key-value store under this key.

The key-value store also holds SUMMARY: counts per status, pages processed, whether the run stopped early, and billing counts. It contains no document text and no URLs.

Status codes

statusMeaningCharged
okText was extracted.yes
no_textNo processed page has a text layer. Probably a scan; this Actor does no OCR. reason is NO_TEXT_LAYER.no
not_pdfThe download is not a PDF (NOT_A_PDF).no
too_largeLarger than maxFileSizeMb (FILE_TOO_LARGE).no
encryptedA password is needed to open it (PASSWORD_REQUIRED). PDFs that only restrict printing or copying open normally.no
unreachableDNS, connection or TLS failure, HTTP 4xx or 5xx, too many redirects.no
timeoutThe download or the conversion passed timeoutPerPdfSecs (REQUEST_TIMEOUT, PDF_TIMEOUT).no
parse_errorThe PDF structure is broken, or pageRange is invalid or selects no page.no
invalid_urlNot a URL, a private or internal address, or a duplicate of an earlier input (DUPLICATE_INPUT).no
budget_stoppedThe run's maximum charge was reached; this URL was not requested.no

Reason codes: INVALID_URL, UNSAFE_ADDRESS, DUPLICATE_INPUT, DNS_FAILED, CONNECTION_FAILED, TLS_ERROR, REQUEST_TIMEOUT, HTTP_4XX, HTTP_5XX, TOO_MANY_REDIRECTS, FILE_TOO_LARGE, NOT_A_PDF, PASSWORD_REQUIRED, PDF_PARSE_FAILED, PDF_TIMEOUT, INVALID_PAGE_RANGE, PAGE_RANGE_EMPTY, NO_TEXT_LAYER, BUDGET_LIMIT, INTERNAL_ERROR.

Pricing

Pay per event. You pay for results, not for runs that fail.

EventPriceWhen
pdf$0.003One PDF with status ok. Covers up to 50 processed pages.
extra-pages-10$0.0005Once per started block of 10 processed pages beyond the first 50. Only if you raise maxPages above 50.

Examples: a 30-page PDF costs $0.003. With maxPages: 200, a 120-page PDF costs $0.003 + 7 x $0.0005 = $0.0065 (70 extra pages = 7 blocks). With the default maxPages of 50 the second event never happens: a longer PDF is cut at 50 pages and the row says truncated: true.

Pages are counted on what was actually converted (pagesProcessed), after pageRange and maxPages. Rows with any other status than ok are free. Platform usage and the Apify actor-start event are billed by Apify as usual.

Spending limit. Before each download the Actor reserves the most that PDF could cost. If the remaining budget of the run cannot cover it, the PDF is not requested and gets a free budget_stopped row; if it covers the base price but not all extra blocks, the PDF is converted up to the pages the budget allows (truncated: true, warning BUDGET_LIMITED_PAGES).

How the Markdown is built

  • Reading order. Text positions are grouped into lines. Two-column pages are detected from an empty vertical band in the middle of the page; lines that cross the band (titles, abstracts) split the page into sections that are read left column first, then right.
  • Headings. The body size is the most common font size by character count. Lines at least 12% larger, in at most four size levels, become # to ####. Short lines set in a bold font at body size become headings when bold text is not the norm in the document.
  • Lists. Bullet glyphs (including Korean □ ○ ▪ ㆍ), 1. 1) (1), 가. and Roman numerals start list items; wrapped lines are joined to their item.
  • Paragraphs. Lines are re-flowed. A new paragraph starts on a larger line gap than the document's line spacing, a first-line indent, or a short line that ends a sentence. Hyphenation at line ends is removed (trans- + former); hyphenated compounds that continue with another hyphen are kept.
  • Tables. Consecutive lines whose text sits in the same vertical columns become a Markdown table. This uses text positions only.
  • Headers and footers. Margin lines that repeat across pages and bare page numbers (Arabic and Roman) are removed.
  • CJK. PDF.js is given its bundled CMaps and standard fonts. Hangul words are separated by the spaces the PDF actually contains; Han and kana are joined without spaces.

Limits - read before you rely on it

  • No OCR. Scanned or image-only pages produce no text. Check pagesWithoutText and scannedLikely.
  • Tables are heuristic. Ruled tables without aligned text, merged cells and cells that wrap over several lines are not reliable: a wrapped cell becomes several rows. A block of aligned text such as an author list can be read as a table.
  • Layout. Only one or two text columns are handled. Rotated text is skipped (ROTATED_TEXT_SKIPPED), vertical Japanese text is not supported, and text inside figures is returned as the PDF stores it.
  • Slides and forms. Slide decks and forms have no prose structure; expect many short headings and table fragments.
  • Garbled text cannot always be detected. garbledRatio counts replacement, private-use and control characters. A PDF whose fonts map glyphs to wrong but valid letters passes the check.
  • Missing spaces. Where a PDF packs words together without space characters or clear gaps (condensed, justified Korean text, for example), PDF.js returns the words without a space and so do we. Spot checks of Korean government PDFs showed it in a minority of lines.
  • Hyphenation at line ends is a guess: some real hyphens before a lowercase word are removed.
  • Equations, footnote markers and superscripts come out as plain inline text.
  • Password-protected PDFs are not opened. Files over maxFileSizeMb are not parsed. Memory: the default of 1024 MB is enough for typical documents; the Actor parses one PDF at a time.

Responsible use

You are responsible for having the right to process the PDFs you submit and for the terms of the sites you fetch them from. The Actor fetches only the URLs you list, sends a descriptive User-Agent, and does not store documents beyond the run's dataset.

Technical notes

Built on PDF.js (pdfjs-dist, Apache-2.0) and the Apify SDK. See THIRD_PARTY_NOTICES.md in the source.

For agents and MCP clients

  • No credentials, cookies or API keys are needed; the PDFs must be public http(s) URLs.
  • Every input URL gets one row with status (ok, no_text, not_pdf, too_large, encrypted, unreachable, timeout, parse_error, invalid_url, budget_stopped) and a reason code; scannedLikely and garbledRatio flag documents that need OCR or review (the Actor does no OCR).
  • Rows are bounded: files over maxFileSizeMb (default 30) are refused, at most maxPages (default 50) are converted, and a row larger than about 8 MB moves its content to the key-value store (outputRecordKey).
  • Cost is bounded before the run starts: urls × $0.003 for up to 50 pages each, plus $0.0005 per extra block of 10 pages only if you raise maxPages above 50; only ok rows are charged.
  • Use it from Claude, Cursor or any MCP client through the Apify MCP server (https://mcp.apify.com) — the tool arguments come from this Actor's input schema.