PDF to Text & Markdown Extractor for LLM & RAG avatar

PDF to Text & Markdown Extractor for LLM & RAG

Pricing

from $2.00 / 1,000 pdf document processeds

Go to Apify Store
PDF to Text & Markdown Extractor for LLM & RAG

PDF to Text & Markdown Extractor for LLM & RAG

PDF to text and Markdown for LLMs and RAG: headings, lists, metadata, page ranges and ready chunks with page numbers. Input PDF URLs, arXiv/landing pages, web pages that link to PDFs, uploads, base64 or a key-value store. Password PDFs supported. Text layer only (no OCR).

Pricing

from $2.00 / 1,000 pdf document processeds

Rating

0.0

(0)

Developer

Adam Plänitz

Adam Plänitz

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a day ago

Last modified

Features

Limited permissions

Share

Convert PDF to text and PDF to Markdown in bulk – a PDF parser and PDF text extractor built for LLMs, RAG pipelines and AI agents. Paste PDF links, arXiv or journal landing pages, or a web page that links to PDFs; upload files, send base64 from an automation or pick an Apify key-value store. For every document you get clean Markdown (headings, paragraphs, lists), plain text, metadata, optional one row per page and ready-to-embed chunks with page numbers. Choose a page range and pay only for the pages you extract. Export as JSON, CSV or Excel, or call it from n8n, Make, Zapier, LangChain, the API or an MCP client.

Click Start without changing anything to try it on two public documents (NIST Cybersecurity Framework 2.0 and the Mistral 7B paper, 41 pages, about $0.025).

What does it do?

  1. Collects the PDFs from any mix of sources:
    • PDF URLs – direct links; redirects are followed.
    • Landing pages – if a URL returns a web page instead of a PDF (e.g. https://arxiv.org/abs/2310.06825), the Actor follows the PDF the page declares: the citation_pdf_url tag used by arXiv, journals and repositories, an embedded PDF viewer, or the only PDF link on the page.
    • Web pages with PDF links – e.g. a "Reports" or "Publications" page. The page is read once and up to N linked PDFs are processed (one level, no crawling).
    • Uploads, base64 strings (for API calls and automations) and records of a key-value store.
  2. Reads the text layer with pdf.js (via unpdf) – only the pages in your page range. Password-protected PDFs are opened with the password you enter.
  3. Rebuilds the structure: fragments become lines and paragraphs; headings are detected from font size and font (#, ##, ###); bullet and numbered lists become Markdown lists; words hyphenated at line ends are joined; running headers, footers and page numbers that repeat on many pages are removed.
  4. Chunks (optional): splits the Markdown into pieces of at most N characters with overlap, cut at paragraph, line or sentence boundaries. Each chunk carries its offset, first and last page and the nearest heading – metadata for your vector store and for citations.

Files that cannot be processed (download errors, non-PDFs, scanned PDFs without text, wrong password) get a free row with an error code.

Who is it for?

  • RAG and chatbot builders who need PDFs as Markdown chunks with page numbers in a vector database.
  • AI agent and LLM app developers who want a model to read a PDF as compact text instead of a binary file – via API, MCP or LangChain.
  • Analysts, researchers and automation builders (n8n, Make, Zapier) who extract text and metadata from many reports, papers or documents.

Use cases

  1. RAG pipeline: set Chunk size to e.g. 2000, run on your manuals, policies or standards and load chunks (text + pageStart/pageEnd + heading) straight into Pinecone, Qdrant, pgvector or a LangChain/LlamaIndex vector store. Answers can cite the page.
  2. Invoice and report processing: send invoices or monthly reports as base64 or key-value store records from n8n/Make, use Page range 1-2 to read only the first pages, and pass the text to an LLM or your own parser for amounts, dates and totals.
  3. Searchable research PDFs: paste arXiv abstract pages or a publications page of an institute; get title, dates and full Markdown for every paper, ready for full-text search, summaries or classification.

Input

FieldDefaultDescription
PDF URLstwo examplesDirect PDF links or landing pages, one per line.
Web pages with PDF links–Pages whose linked PDFs should be processed.
Maximum PDFs per web page20Limit per listed web page.
Upload PDF files–Upload from your computer (stored in your Apify storage).
Base64 PDFs (API)–["JVBERi0x…"] or [{"fileName": "invoice.pdf", "data": "JVBERi0x…"}].
Key-value store with PDFs / Record keys–All records of a store, or only the listed keys.
PDF password–Used for PDFs that need a password to open (secret field).
Follow landing pages to their PDFonSee above.
OutputMarkdown and textMarkdown only, plain text only, or both.
One row per pageoffExtra rows (itemType: "page") with page number and text.
Page rangealle.g. 1-5, 8, 10-. Only extracted pages are charged.
Maximum pages per document1000Safety limit.
Remove running headers and footersonDrops repeating top/bottom lines and page numbers.
Chunk size / Chunk overlap0 (off) / 200Characters per chunk and shared characters.
Maximum file size50 MBUp to 200 MB with more memory.
Parallel documents, Download timeout, Respect robots.txt, Proxy3, 60 s, on, noneDownload behaviour.

The example URLs are the input default. If you send only uploads, base64 files, a key-value store or web pages (e.g. via API), the examples are skipped automatically, so you never pay for them by accident. The aliases startUrls ([{ "url": "…" }]) and url are accepted as well.

Example input

{
"pdfUrls": [
"https://arxiv.org/pdf/2310.06825v1",
"https://arxiv.org/abs/2310.06825"
],
"webPageUrls": ["https://www.example.org/annual-reports"],
"maxPdfsPerWebPage": 10,
"outputFormat": "both",
"pageRange": "1-20",
"chunkSize": 2000,
"chunkOverlap": 200
}

Example output

One row per document (shortened, from a real run on the Mistral 7B paper with chunk size 2000):

{
"itemType": "document",
"source": "https://arxiv.org/pdf/2310.06825v1",
"sourceType": "url",
"fileName": "2310.06825v1.pdf",
"contentType": "application/pdf",
"fileSizeBytes": 3749788,
"sha256": "dfbac4e7035344b305c947481f2e7e8a02f7a24a563917eb6e47f6591d14c5ae",
"title": "Mistral 7B",
"titleSource": "first-heading",
"creationDate": "2023-10-11T00:48:17.000Z",
"creator": "LaTeX with hyperref",
"producer": "pdfTeX-1.40.25",
"pdfVersion": "1.5",
"pageCount": 9,
"pagesExtracted": 9,
"pageRange": "1-9",
"pagesWithoutText": [],
"wordCount": 3840,
"charCount": 24970,
"text": "Mistral 7B\n\n…",
"markdown": "# Mistral 7B\n\n…\n\n## Abstract\n\nWe introduce Mistral 7B, a 7–billion-parameter language model engineered for superior performance and efficiency. …",
"chunkCount": 16,
"chunks": [
{ "index": 1, "text": "## Abstract\n\nWe introduce Mistral 7B, …", "charStart": 989, "charCount": 1728, "pageStart": 1, "pageEnd": 1, "heading": "Abstract" }
],
"headersFootersRemoved": 8,
"truncatedByMaxPages": false,
"truncatedByCostLimit": false,
"warning": null,
"errorCode": null,
"error": null
}

Rows from a landing page also contain landingPageUrl; rows from a web page contain foundOnPage. With One row per page you also get { "itemType": "page", "pageNumber": 3, "text": "…", "markdown": "…", "wordCount": 412, "hasText": true }. The PDF's author field is deliberately not included.

Error codes include HTTP_404, ENOTFOUND, ROBOTS_TXT, FILE_TOO_LARGE, NOT_A_PDF, WEB_PAGE_WITH_PDF_LINKS, NO_PDF_LINKS, INVALID_PDF, ENCRYPTED, WRONG_PASSWORD, NO_TEXT_LAYER, PAGE_RANGE_EMPTY, KVS_RECORD_NOT_FOUND. Documents too large for one dataset item (about 9 MB of text) are stored in the run's key-value store and linked in textRecordUrl, markdownRecordUrl and chunksRecordUrl. The record RUN-SUMMARY holds counts and error codes.

How much does it cost?

Pay per event – you only pay for what was extracted:

EventPrice
Actor start$0.00005
Document processed$0.002
Page extracted$0.0005

Failed downloads, non-PDF files, scanned PDFs without text, wrong passwords and web pages without PDF links are free. Page rows and chunks cost nothing extra. Platform usage is included.

Examples

  • 1 PDF with 5 pages: $0.00005 + $0.002 + 5 × $0.0005 = $0.0046
  • The two example documents (41 pages): $0.00005 + 2 × $0.002 + 41 × $0.0005 = $0.0246
  • 1,000 one-page invoices: $0.00005 + $2.00 + $0.50 = $2.50
  • 100 PDFs with 20 pages each: $0.00005 + $0.20 + 2,000 × $0.0005 = $1.20
  • The same 100 PDFs, only pages 1-3: $0.00005 + $0.20 + 300 × $0.0005 = $0.35

Honest comparison: other PDF text extractors in the Apify Store mostly charge a flat price per PDF regardless of its length (in November 2026 roughly $0.0018–$0.005 per PDF without OCR, see their pricing tabs). This Actor is cheaper for short documents (up to about 2–6 pages, depending on the competitor) and whenever you only need a page range, but more expensive for long PDFs read in full – a 20-page PDF costs $0.012 here. If you mostly convert long documents completely and do not need Markdown or chunks, a flat-price Actor will be cheaper.

You can set a maximum cost per run; the Actor stops cleanly when it is reached (the last document may be cut short – its row says so). Without browser or OCR, runs are fast: the two example documents take about 2 seconds of processing.

Use with n8n, Make, Zapier, API, MCP and LangChain

The Actor ID is adamplaenitz/pdf-text-extractor.

  • n8n: use the official Apify node → Run Actor and get dataset items, paste the input JSON. Base64 from a previous node fits into base64Pdfs.
  • Make: the official Apify app → Run an Actor (synchronous) → Get dataset items.
  • Zapier: the official Apify integration → action Run Actor, then Fetch dataset items.
  • API (one request, returns the rows):
curl -X POST "https://api.apify.com/v2/acts/adamplaenitz~pdf-text-extractor/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"pdfUrls": ["https://arxiv.org/pdf/2310.06825v1"], "outputFormat": "markdown", "chunkSize": 2000}'
  • MCP (Claude, Cursor, other AI agents): add the Apify MCP server with this Actor, e.g. https://mcp.apify.com/?tools=adamplaenitz/pdf-text-extractor. The agent can then read PDFs by URL.
  • LangChain (Python, package langchain-apify):
from langchain_apify import ApifyWrapper
from langchain_core.documents import Document
apify = ApifyWrapper() # reads APIFY_API_TOKEN from the environment
loader = apify.call_actor(
actor_id="adamplaenitz/pdf-text-extractor",
run_input={"pdfUrls": ["https://arxiv.org/pdf/2310.06825v1"], "chunkSize": 2000},
dataset_mapping_function=lambda item: Document(
page_content=item.get("markdown") or item.get("text") or "",
metadata={"source": item["source"], "title": item.get("title")},
),
)
docs = loader.load()

FAQ

Does it work with scanned PDFs? Only PDFs with a text layer are read – there is no OCR. A scanned PDF without text gets a free NO_TEXT_LAYER row; partly scanned documents get a warning and the list pagesWithoutText. Run such files through an OCR tool first (many scanners and Acrobat can add a text layer), then use this Actor.

Can I extract only some pages? Yes – Page range such as 1-3, 10-. Only those pages are read and charged; pageCount still shows the total.

Can I give it a website instead of PDF links? Put the page into Web pages with PDF links: the Actor reads that page once and processes up to Maximum PDFs per web page linked PDFs. Links created by JavaScript are not seen, and it does not crawl further pages.

Are tables extracted? Table text is kept in reading order, but as lines of text, not as structured cells or Markdown tables. Multi-column layouts follow the order stored in the PDF (usually correct).

What about password-protected PDFs? Enter the password in PDF password. Without it you get a free ENCRYPTED row, with a wrong one WRONG_PASSWORD. PDFs that only restrict printing or copying are read without a password.

Data, rights and privacy

  • You are responsible for having the right to process the documents you submit (copyright, licences, confidentiality, personal data). The Actor only processes the files and pages you provide, respects robots.txt by default and refuses private or internal addresses.
  • The example documents are freely available: the NIST Cybersecurity Framework 2.0 is a work of the U.S. government; the Mistral 7B paper is published on arXiv under CC BY 4.0 (Jiang et al., arXiv:2310.06825).
  • Uploaded files stay in your own Apify storage. Open-source components: pdf.js (Apache-2.0) via unpdf (MIT), robots-parser (MIT), got-scraping (Apache-2.0). Not affiliated with Mozilla, NIST, arXiv or any publisher.

Questions or feature requests? Please open an issue in the Issues tab.