PDF Extractor: PDF → Clean Markdown + JSON for LLM/RAG
Pricing
from $3.00 / 1,000 results
PDF Extractor: PDF → Clean Markdown + JSON for LLM/RAG
Turn any PDF URL into clean, LLM-ready Markdown + structured JSON (title, metadata, per-page text, page count, word count, token count). Perfect for RAG pipelines, AI agents, and LLM document ingestion.
Pricing
from $3.00 / 1,000 results
Rating
0.0
(0)
Developer
Marvin Eguilos
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
2 days ago
Last modified
Categories
Share
PDF Extractor — PDF → Clean Markdown + JSON for LLM & RAG
Give it a PDF URL. Get back clean, LLM-ready Markdown and structured JSON. Title, metadata, per-page text, page count, word count, and an accurate token count — every document, one tidy result. Built for RAG pipelines, AI agents, and anyone who needs the text of a PDF without wrestling with binary parsing, broken encodings, or page-layout noise.
Feed your PDFs to your LLM the way it wants to be fed: as clean Markdown, chunkable by page, with the token budget already counted.
✨ What it does
- Robust PDF text extraction — powered by Mozilla's
pdf.js(viaunpdf), the same battle-tested engine that renders PDFs in Firefox. Handles multi-page documents, embedded fonts, and complex layouts. - Clean Markdown — normalized whitespace, collapsed noise, optional per-page separators (
--- Page N ---) so you can chunk on natural document boundaries. - Structured JSON —
title,metadata(author, subject, keywords, creator, producer, creation/modification dates, PDF version),pageCount,pages[](per-page text),wordCount,tokenCount,fileSizeBytes,fetchedAt. - Accurate token counts — counted with the GPT/
cl100k-family tokenizer so you know exactly how much context each PDF costs before you send it to a model. - Token budgeting — optional
maxTokenstruncates output to fit your context window. - Page-level chunking — the
pages[]array gives you clean text per page, ideal for granular RAG retrieval and citations. - Robust by design — one bad URL never kills the run. Failed downloads/parses return a clean error record (and are never charged).
- Safe & efficient — file-size guard,
%PDF-magic-byte validation, and content-type checks reject non-PDFs before wasting compute.
🎯 Use cases
| You want to… | This Actor gives you… |
|---|---|
| Build a RAG knowledge base from PDFs | Clean Markdown + per-page text with token counts, ready to embed. |
| Ingest research papers (arXiv, journals) | Structured text + metadata your pipeline can index and cite. |
| Feed reports / whitepapers to an LLM | Pre-counted tokens so you never blow the context window. |
| Give an AI agent document context | Structured JSON your agent can reason over — no binary noise. |
| Convert PDF docs to Markdown | Portable, diff-friendly Markdown you can drop into a repo or wiki. |
| Chunk documents by page for citations | A pages[] array with clean text and page numbers. |
📥 Input
| Field | Type | Default | Description |
|---|---|---|---|
urls | string[] | — (required) | One or more direct links to PDF files. Each successful PDF is one result. |
outputFormat | both | markdown | json | both | Include Markdown, the JSON fields, or both. |
includePageText | boolean | true | Include a pages[] array with per-page text in the JSON output. |
pageSeparators | boolean | true | Insert --- Page N --- markers between pages in the Markdown. |
maxPagesPerRun | integer | 1000 | Safety cap on PDF URLs processed per run. |
maxTokens | integer | 0 | Truncate Markdown to ~N tokens (0 = no limit). |
maxFileSizeMb | integer | 100 | Skip PDFs larger than this size (recorded as failures, never charged). |
Example input
{"urls": ["https://arxiv.org/pdf/1706.03762","https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"],"outputFormat": "both","includePageText": true,"pageSeparators": true,"maxTokens": 0}
📤 Output
One dataset item per PDF. Successful example (truncated):
{"url": "https://arxiv.org/pdf/1706.03762","finalUrl": "https://arxiv.org/pdf/1706.03762","statusCode": 200,"title": "Attention Is All You Need","metadata": {"title": "Attention Is All You Need","author": "Ashish Vaswani et al.","creator": "LaTeX with hyperref","producer": "pdfTeX","creationDate": "D:20170612...","pdfVersion": "1.5"},"pageCount": 15,"fileSizeBytes": 2215244,"wordCount": 8823,"tokenCount": 13140,"fetchedAt": "2026-07-19T02:17:19.954Z","markdown": "Attention Is All You Need\n\n...\n\n---\n\n**Page 2**\n\n...","pages": [{ "page": 1, "text": "Attention Is All You Need\n\n..." }]}
Failed URL (returned to a separate failures dataset, not charged):
{"url": "https://not-a-real-domain-xyz.com/file.pdf","finalUrl": "https://not-a-real-domain-xyz.com/file.pdf","statusCode": null,"error": "getaddrinfo ENOTFOUND not-a-real-domain-xyz.com","fetchedAt": "2026-07-19T02:17:19.831Z"}
🔌 Call it from code (Apify API)
curl -X POST "https://api.apify.com/v2/acts/YOUR_USERNAME~pdf-extractor/run-sync-get-dataset-items?token=YOUR_TOKEN" \-H "Content-Type: application/json" \-d '{"urls":["https://arxiv.org/pdf/1706.03762"]}'
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: 'YOUR_TOKEN' });const { defaultDatasetId } = await client.actor('YOUR_USERNAME/pdf-extractor').call({ urls: ['https://arxiv.org/pdf/1706.03762'] });const { items } = await client.dataset(defaultDatasetId).listItems();console.log(items[0].markdown);
💸 Pricing (Pay-Per-Event)
| Event | Price |
|---|---|
| Actor start | $0.05 per run |
| Extracted PDF | $0.003 per successfully extracted PDF |
- You only pay for PDFs that succeed — failed URLs are never charged.
- 🎁 Free tier: free-plan users' platform usage is covered by Apify, so you can try it and run small jobs at no cost before scaling up.
- Structured per-page JSON + accurate token counts, purpose-built for LLM/RAG ingestion — at a low, predictable price point.
⚖️ Acceptable use
This is a general-purpose format-conversion tool: you supply the PDF URLs and are responsible for having the right to download and use the content you submit. The Actor identifies itself with a descriptive User-Agent and only extracts text from documents you point it at. It does not target any single platform's private API and does not harvest personal data as a feature. Please comply with each source's terms of service and applicable law.
🧱 Under the hood
Node.js · unpdf (Mozilla pdf.js core, serverless-friendly) · gpt-tokenizer · Apify SDK. Pure-JS extraction — no headless browser, no system libraries. Stateless — nothing is stored between runs.