PDF Text Extractor: Markdown, RAG Chunks, OCR & Search avatar

PDF Text Extractor: Markdown, RAG Chunks, OCR & Search

Pricing

from $2.00 / 1,000 pdf reads

Go to Apify Store
PDF Text Extractor: Markdown, RAG Chunks, OCR & Search

PDF Text Extractor: Markdown, RAG Chunks, OCR & Search

Extract text from PDFs as Markdown or plain text for AI and RAG: chunks with their page and heading, keyword mentions by page, a file per PDF and one for the run. Page ranges, OCR for scans in 18 languages. By URL, no API key. $2 per 1,000 PDFs; no text, no charge.

Pricing

from $2.00 / 1,000 pdf reads

Rating

0.0

(0)

Developer

Spyridon Pikoulas

Spyridon Pikoulas

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a day ago

Last modified

Features

Limited permissions

Share

Give it the addresses of PDF files and get their content back ready for an AI model:

  • Markdown that keeps the structure: headings from the font sizes, bold, bullet lists and code blocks, paragraphs rejoined across line breaks and hyphenated words made whole. Or plain text.
  • Chunks for RAG: each PDF split into passages of about the words you choose, whole paragraphs, a new one at a heading, each with its pages and the heading it falls under: ready to embed, and to cite by page.
  • Keyword search: every place a word or phrase is said in each PDF, with its page and the text around it.
  • Files you can hand over: each PDF as a Markdown file, never cut short, and the whole run's in one documents.md to drop into a chat or a knowledge base.
  • The pages you want: a range such as 1-5, 8, 20-, the whole document or page by page.
  • OCR for scanned pages, only if you turn it on and only on pages with no text, in 18 languages from English, German and French to Arabic, Hindi, Chinese, Japanese and Korean.
  • Title, page count and dates with each PDF, and files up to 100 MB.

It costs $2 per 1,000 PDFs on Apify's paid plans and $4 on the free plan, whatever their length. OCR adds $3 per 1,000 scanned pages ($6 on the free plan). A PDF that can't be fetched or gives no text costs nothing.

What people use it for

  • AI and RAG pipelines: reports, papers, manuals and filings as chunks to embed, each citing its page, or as Markdown to hand to an LLM whole.
  • Due diligence and compliance: every mention of a company, a risk or a clause across a stack of reports, filings or contracts, by page.
  • Research: the text of a list of public reports or papers without opening each one.
  • Monitoring: a document published at a fixed URL, compared run by run.
  • Automation: PDF text as one step of a Make, Zapier or n8n workflow, or a tool for an AI agent.

How to extract text from a PDF

  1. Click Try for free; Apify's free plan covers a first run.
  2. Enter the PDF URLs.
  3. Pick Markdown or Plain text, and the Pages if you want only some.
  4. For RAG, set Chunks for RAG, 300 words for example; to search, add Keyword mentions.
  5. Turn on OCR scanned pages if your files are scans, and pick their language.
  6. Click Start, then download the results as JSON, CSV or Excel.

An input with every option:

{
"urls": ["https://www.rfc-editor.org/rfc/rfc9309.pdf"],
"outputFormat": "markdown",
"pageRange": "1-5, 8",
"ocr": true,
"ocrLanguage": "eng",
"includePages": true,
"chunkWords": 300,
"keywords": ["crawler", "cache"],
"saveFiles": true,
"maxPagesPerPdf": 200
}

Output

{
"url": "https://www.rfc-editor.org/rfc/rfc9309.pdf",
"finalUrl": "https://www.rfc-editor.org/rfc/rfc9309.pdf",
"fileName": "rfc9309.pdf",
"title": "RFC 9309: Robots Exclusion Protocol",
"pageCount": 12,
"pagesRead": 12,
"ocrPages": 0,
"ocrSkippedPages": 0,
"sizeBytes": 177688,
"createdAt": "2022-09-09T17:39:45-07:00",
"modifiedAt": "2022-09-09T17:39:47-07:00",
"markdown": "# RFC 9309 Robots Exclusion Protocol\n\n## Abstract\n\nThis document specifies and extends the \"Robots Exclusion Protocol\" method originally defined by Martijn Koster in 1994…\n\n#### 2.2.1. The User-Agent Line\n\nCrawlers set their own name…\n\n```\n+==========================================+========================+\n| User-Agent HTTP header | robots.txt user-agent |\n…",
"truncated": false,
"contentUrl": "https://api.apify.com/v2/key-value-stores/7qcdZpxnDJbJiqapF/records/00000-rfc9309.md?signature=1aOnge3Be0kEgE3QrCPe2",
"keywordMentionCount": 16,
"keywordMentions": [
{"keyword": "crawler", "page": 3, "text": "A line with a key-value pair that defines how a crawler may access URIs. See Section 2.2.2. One or more user-agent lines that are followed by one or more r…"}
],
"chunks": [
{"index": 4, "pageStart": 4, "pageEnd": 5, "heading": "2.2.1. The User-Agent Line", "text": "#### 2.2.1. The User-Agent Line
Crawlers set their own name, which is called a product token, to find relevant groups. The product token contain only uppercase…", "words": 253}
],
"error": null
}

That run, with "chunkWords": 250 and two keywords, gave 17 chunks and 16 mentions; one of each is shown, and the text shortened. The Chunks and Keyword mentions views list them one per row.

With Plain text, the content comes under text instead of markdown. pages, with Text page by page on, holds each page's content, its number and whether OCR read it. A PDF that can't be read comes with url and error, saying why. ocrSkippedPages counts scanned pages left without text: OCR was off, or the spending limit came first. contentUrl opens the PDF's whole content as a file, as long as the run's storage is kept; a dataset item holds up to about 8.5 MB, and past that truncated is true and the file is the place to read it all.

Use it as an API

Apify's API starts a run and returns its dataset as JSON; its Python and JavaScript clients, and its Make, Zapier and n8n integrations, work the same way.

curl -X POST "https://api.apify.com/v2/acts/pikoulas~pdf-text/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://www.rfc-editor.org/rfc/rfc9309.pdf"], "pageRange": "1-3"}'

AI agents can call it as a tool through Apify's MCP server: https://mcp.apify.com?tools=pikoulas/pdf-text.

How much does it cost?

A PDF is $0.002 and a page read by OCR $0.003. A thousand text PDFs cost $2; a hundred scans of 20 pages each cost $6.20. Set a spending limit on a run and it stops there, with what it has read so far. Chunks, keyword mentions and the files cost nothing more.

Good to know

  • How the Markdown is made. It is read from the PDF's own layout: text larger than the body is a heading, a line in bold alone is a heading too, a fixed-pitch font is a code block. Tables come as their text in reading order, not as Markdown tables, and a page in columns as the PDF orders it.
  • Chunks follow the document: paragraphs are never split, so a chunk can run past the words asked when a paragraph is long, and a heading starts a new chunk once the one under way is half full. A chunk's heading is the last heading before it starts. Keywords match whole words in any case, "cache" not "caches".
  • Text PDFs need no OCR: leave it off and a 500-page PDF is read in seconds. With it on, only pages with almost no text and an image are read by OCR, so a PDF with text costs no more.
  • A site's refusal is respected. It names itself in its User-Agent and reads each site's robots.txt, one request a second per site at most. A path robots.txt refuses isn't fetched, and a site that answers 401, 403 or 451, shows a verification page or answers 429 twice is left alone for the rest of the run; the rest of your list goes on. It uses no proxy and doesn't try to get past any of this, so a file behind a check comes back with an error.
  • Protected PDFs aren't read. A PDF that needs a password, or whose permissions forbid copying its text, comes back with an error, and costs nothing.
  • Only public addresses are fetched, not private networks.
  • Very large text is cut to fit a dataset item, about 8 MB: pages goes first, then the end of the content, and truncated is true.
  • OCR writes what it reads: tables and handwriting can come out wrong.
  • The author's name in a PDF's metadata is left out. The text itself comes as it stands, names included.
  • Contact. The Actor keeps nothing itself: each PDF stays on disk only while it's being read, and results sit in the dataset of whoever ran it. Questions or requests go to spyridwn.pd@gmail.com.
  • Reads PDFs with PDFium and scanned pages with Tesseract OCR; based in part on the work of the FreeType Team.

FAQ

It reads only the files you point it at, as anyone could download them, without logging in, and it keeps to each site's robots.txt. You are responsible for having the right to use them: documents are usually their authors' copyrighted work, a site's terms may limit how you use what it publishes, including using it with AI models, and personal data in them is protected by laws such as the GDPR and the CCPA. If you're unsure, ask a lawyer; Apify's Is web scraping legal? is a good start.

Can it read scanned PDFs?

Yes, with OCR scanned pages on: a page with almost no text and an image is read with Tesseract in the language you pick, and its text goes into the Markdown or text with the rest.

Does it read PDFs I upload?

It reads URLs. A file on your own computer needs an address first: upload it to a key-value store in Apify Console (Storage) and give the record's signed URL, which the Actor reads through Apify's API.

Something missing or not working?

Open an issue on the Issues tab with the input you used, or ask there for a field you need.

If it does what you need, a review on the Reviews tab helps others find it.