PDF & Office to Markdown: Tables, Headings, OCR Fallback
Pricing
from $0.50 / 1,000 pages
PDF & Office to Markdown: Tables, Headings, OCR Fallback
Convert PDFs, DOCX, PPTX and images to clean markdown for RAG: real tables, heading levels, page anchors, per-page token counts. Tesseract OCR runs only on pages without a text layer. Input from URLs, key-value store files or a dataset of links. Per-file error codes.
Pricing
from $0.50 / 1,000 pages
Rating
0.0
(0)
Developer
Dano Desk
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
13 hours ago
Last modified
Categories
Security
Limited permissionsShare
Turn PDFs, Word (DOCX), PowerPoint (PPTX) and images into clean markdown for RAG pipelines and LLMs:
- Real tables: ruled PDF tables become markdown tables (merged-cell artefacts removed, pipes escaped), with page and bounding box.
- Heading levels:
#/##/###from the PDF's font-size hierarchy and bold section titles; DOCX heading styles; one## Slide N: titleper slide. - Page anchors for citations:
<a id="page-7"></a>before each page (or HTML comments,## Page N, or none). - Per-page token counts (tiktoken
cl100k_baseoro200k_base) to plan chunking. - OCR only where needed: Tesseract runs only on pages without a text layer (scans), and on image files. In default
automode, native-text pages are not OCR'd;forceexplicitly OCRs all selected pages. - Clean text: repeated headers/footers and page numbers removed, hyphenated line breaks rejoined (real compounds like high-level kept), bullet glyphs turned into lists.
- Inputs: URLs, files in Apify key-value stores, or a dataset of links (for example from a crawler).
- Robust batches: each file gets its own error code; partial successes are retained. An all-file failure or billing-contract/limit failure can fail the run.
Quick start
{"urls":["https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"],"pageRange":"1","outputMode":"pages","ocrMode":"auto"}
Read paid native pages from the dataset; open OUTPUT.files[].resultUrl for document summaries, OCR output and errors.
Input
| Field | What it does |
|---|---|
urls | Public document URLs (PDF, DOCX, PPTX, PNG/JPEG/TIFF/GIF/BMP/WEBP). |
keyValueStoreId + keyValueStoreKeys | Pick one of your key-value stores and list the file keys. The Actor runs with limited permissions and gets read-only access to that store only. |
keyValueStoreRecords | Advanced: storeIdOrName/key for stores this Actor created, or key for the run's own store. |
datasetId + datasetUrlField | Read URLs from a dataset (read-only access to that dataset only); dotted paths like file.url work. |
pageRange | PDF pages to convert, e.g. 1-5,9,12-. |
tableStrategy | lines (ruled tables, default), text (also whitespace tables), off. |
ocrMode | auto (default), force, off. ocrLanguages: eng, deu, fra, spa, ita, por, nld. |
outputMode | Controls KV result records: document = document summary/full markdown; pages = summary + page rows. Default dataset always holds only nonempty native-text pages. |
pageMarker | anchor, comment, heading, none. |
pdfPassword | Secret. Tried for encrypted PDFs; never written to output. |
| Limits | maxFiles 100, maxFileSizeMb 50, maxPagesPerFile 300, maxOcrPagesPerFile 30, ocrDpi 200, timeouts. |
Empty input runs a demo: pages 1-3 and 29-30 of the NIST Cybersecurity Framework 2.0 PDF (a U.S. government work) plus a small DOCX, PPTX and scanned-style PNG generated by the Actor.
Output
Complete KV result-record rows (recordType):
document: source, fileName, fileType, status (ok/partial), title, totalPages, pagesConverted, nativePages, ocrPages, emptyPages, tableCount, headingCount, tokens,pages[](page, anchor, methodtext/ocr/empty/error, tokens, chars, tables, ocrConfidence),tables[](page, bbox, rows, cols), markdown, markdownUrl, warnings.page(outputModepages): one row per page with its markdown and token count.error: source, errorCode, message (and httpStatus for HTTP errors).
The default dataset contains only nonempty native-text page rows (method: "text"), independent of outputMode. Each paid row includes resultKey and resultUrl pointing to the complete KV result. OCR pages, document summaries, empty pages and errors do not become default-dataset rows.
Open OUTPUT in the key-value store: each files[] entry has its status and resultKey / resultUrl. The referenced result-... JSON record is { "outputMode": "document" | "pages", "rows": [...], "pages": [...] }; it retains the chosen document/page output plus all converted page details, including OCR content and diagnostic/error rows. Store/API access requires permission to the run's KV store. OUTPUT.counts records file, native/OCR-page, token and table totals; errorCodes and warnings expose partial failures and caps.
When saveMarkdownFiles is true (default), complete document markdown is also saved as an .md KV record. Its markdownKey/markdownUrl is available in the document summary, and markdownKey is included in the corresponding OUTPUT.files entry. Dataset table views show native pages and their markdown only; use KV result records for document/OCR/error review.
Pricing
| Live event | Billable unit | USD |
|---|---|---|
apify-default-dataset-item | One nonempty native-text page delivered to the default dataset | $0.0005 |
scanned-page | One successfully converted nonempty OCR page, with content retained in KV | $0.003 |
apify-actor-start | Automatic start event per started GB (minimum one), including empty/error runs | $0.00005 |
Native and OCR page events are mutually exclusive for a page: OCR content never also incurs the native dataset-page charge. Document/page-summary/error rows and empty pages have no page-event charge. 1,000 native pages cost $0.50 in page events; 1,000 OCR pages cost $3.00, plus the standard start fee. DOCX page units are explicit-page-break sections and PPTX page units are slides.
Set Apify's maxTotalChargeUsd run option and input page/file limits. When an event budget is exhausted, further paid native-page delivery or OCR charging stops; already-produced KV artifacts can remain. This README/schema patch does not change runtime billing or prices.
Error codes
Per file: INVALID_URL, BLOCKED_URL (private/loopback hosts), DOWNLOAD_HTTP_ERROR, DOWNLOAD_TIMEOUT, DOWNLOAD_FAILED, FILE_TOO_LARGE, EMPTY_FILE, KV_RECORD_NOT_FOUND, DATASET_NOT_FOUND, UNSUPPORTED_TYPE (legacy .doc/.ppt, XLSX, ODT, HTML pages...), ENCRYPTED_PDF, CORRUPT_FILE, OCR_FAILED, OCR_UNAVAILABLE, NO_TEXT, CONVERSION_FAILED.
Page-level warnings: PAGE_LIMIT, OCR_PAGE_LIMIT, NO_TEXT_LAYER.
Run level: INVALID_INPUT and ALL_FILES_FAILED; billing-contract/limit or unexpected processing failures can also fail a run. A billing-contract mismatch is rejected before file processing.
Limits and honest caveats
- Multi-column PDFs are read line by line top-to-bottom, so two-column papers can interleave columns.
- Borderless tables need
tableStrategy: text, which can also over-detect; check the output. - Formulas, images and charts are not described; text inside images in a text PDF is not OCR'd (only pages with no text layer are).
- DOCX has no fixed pages; its "pages" are sections split at explicit page breaks. PPTX pages are slides.
- OCR quality depends on scan quality;
ocrConfidence(0-100) is reported per page.
Licences
Built only on permissive open-source components (MIT/BSD/Apache-2.0). No AGPL code (PyMuPDF is deliberately not used). See THIRD_PARTY_NOTICES.md.