PDF Text Extractor - Markdown, RAG Chunks, OCR & Metadata avatar

PDF Text Extractor - Markdown, RAG Chunks, OCR & Metadata

Pricing

from $2.17 / 1,000 documents

Go to Apify Store
PDF Text Extractor - Markdown, RAG Chunks, OCR & Metadata

PDF Text Extractor - Markdown, RAG Chunks, OCR & Metadata

Extract clean text or Markdown from PDF (and DOCX) URLs for AI agents and RAG: reading order across columns, de-hyphenation, header/footer removal, page ranges, per-page output or token-sized chunks with overlap, metadata, links, scanned-page detection and optional OCR. One item per document.

Pricing

from $2.17 / 1,000 documents

Rating

0.0

(0)

Developer

Artificially

Artificially

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a day ago

Last modified

Share

PDF Text Extractor – Markdown, RAG Chunks, OCR & Metadata

Turn PDF (and Word .docx) URLs into clean text or Markdown for AI agents and RAG pipelines. Paste document links and get one dataset item per document with the text in reading order, headings and lists, best-effort tables, token-sized chunks with overlap, per-page text, metadata and links. Scanned pages are detected, and you can turn on OCR to read them.

Built by Artificially | Follow us on X @artificially_io

Use with AI agents (MCP)

This actor works as a tool for Claude, ChatGPT, Cursor and other AI agents through Apify's MCP server. Ask something like "read this RFP PDF and list the submission deadlines" and the agent calls it for you. Set compactOutput: true, outputFormat: "markdown" and a small maxPages (or a pageRange such as "1-10") so results fit easily in the agent's context. For long documents use splitBy: "chunk" and let the agent read only the chunks it needs.

Quick setup (sign in with your Apify account when asked):

  • Claude (claude.ai or Claude Desktop): Settings → Connectors → Add custom connector, and paste https://mcp.apify.com?tools=artificially/pdf-text-extractor
  • Claude Code or Cursor via the Apify CLI (latest version, apify upgrade): apify mcp install claude-code --tools artificially/pdf-text-extractor (use cursor instead of claude-code for Cursor)
  • Any MCP client (Cursor, VS Code, Windsurf):
{
"mcpServers": {
"apify": { "url": "https://mcp.apify.com?tools=artificially/pdf-text-extractor" }
}
}

Try asking:

Why this actor

  • Reading order that holds up – text is rebuilt from positions on the page: lines grouped by baseline, 2, 3 and 4-column layouts detected (including narrow justified columns like IRS publications), superscripts attached, words split across lines re-joined ("infor-mation" becomes "information", "English-to-German" stays hyphenated).
  • Clean for RAG – repeated running headers, footers and page numbers are removed, TOC leader dots are collapsed, letter-spaced headings ("G r u n d g e s e t z") are fixed, paragraphs broken by page breaks are merged.
  • Markdown with structure – # headings from font size and section numbering (3.1, 3.2.1), bullet and numbered lists, and pipe tables where the table grid is clear.
  • Chunks ready to embed – splitBy: "chunk" returns chunks of about N tokens with overlap, split at paragraph and sentence boundaries, each with pageStart, pageEnd and the section heading it belongs to.
  • Scanned PDFs handled honestly – image-only pages are detected and listed. With OCR off, fully scanned documents are free and reported as needs_ocr. With OCR on, only pages without a text layer are OCRed.
  • Any download link – redirects are followed, so signed links work (SAM.gov attachment links 303-redirect to S3). arXiv abstract links and IDs, Google Drive, Dropbox and GitHub file links are converted to direct downloads.
  • Word files too – .docx documents are detected automatically and converted with headings, lists, tables and links.
  • You only pay for results – one charge per document with extracted text, whatever its page count. 404s, HTML pages, oversized files, password-protected files and scanned files without OCR cost nothing and are listed in FAILED_DOCUMENTS.

Use cases

  • RAG and knowledge bases – ingest reports, manuals, papers and policies into Pinecone, Weaviate, Qdrant, pgvector or Chroma with splitBy: "chunk".
  • Government contracting – extract statements of work, RFPs and amendments attached to SAM.gov notices and feed them to an LLM for bid/no-bid analysis.
  • Research – turn arXiv papers into Markdown with section headings for summarization and literature reviews.
  • Legal and compliance – convert laws, regulations and contracts (any language) into clean text for search and review.
  • Document monitoring – schedule a run over a list of PDF links and diff the extracted text over time.

Input

FieldTypeDescriptionDefault
urlsarrayPDF or DOCX URLs. Redirects followed; arXiv abs links/IDs, Google Drive, Dropbox and GitHub links convertedRequired
outputFormatstringtext or markdowntext
splitBystringdocument (whole text), page (pages array) or chunk (chunks array). Always one dataset item per documentdocument
chunkSizeintegerTarget chunk size in tokens (1 token ≈ 4 characters)1000
chunkOverlapintegerTokens repeated between consecutive chunks (max half of chunkSize)100
includeMetadatabooleanTitle, author, subject, keywords, creator, producer, dates, PDF version, encryption, tagged, formtrue
extractLinksbooleanClickable links and URLs in the text, with the page they are onfalse
compactOutputbooleanSlim items with only the key fields and the content. Best for AI agentsfalse
pageRangestringPages to extract, e.g. "1-5", "1-3,8,10-12", "20-"all
maxPagesintegerPage limit per document (1–1000), applied after pageRange200
removeHeadersFootersbooleanDrop lines repeated at the top/bottom of at least 40% of pages, and page numberstrue
ocrbooleanOCR pages without a text layer (Tesseract). Needs 1024 MB memory or morefalse
ocrLanguagestringTesseract language code(s): eng, deu, fra, spa, eng+deu…eng
ocrMaxPagesintegerMaximum pages OCRed per document20
pdfPasswordstringPassword for PDFs that need one to open–
maxFileSizeMbintegerLarger files are skipped (free)50

Example input

{
"urls": [
"https://arxiv.org/abs/1706.03762",
"https://www.irs.gov/pub/irs-pdf/p17.pdf",
"https://sam.gov/api/prod/opps/v3/opportunities/resources/files/0cf491f2ff9e4b5fb8d43afbfa917762/download"
],
"outputFormat": "markdown",
"splitBy": "chunk",
"chunkSize": 800,
"chunkOverlap": 80
}

Output

One item per document. The content is in text or markdown (splitBy: "document"), pages (splitBy: "page") or chunks (splitBy: "chunk"); the other content fields are null.

{
"url": "https://arxiv.org/abs/1706.03762",
"finalUrl": "https://arxiv.org/pdf/1706.03762",
"fileName": "1706.03762v7.pdf",
"fileType": "pdf",
"fileSizeBytes": 2215244,
"pageCount": 15,
"pagesExtracted": 15,
"charCount": 39874,
"wordCount": 6042,
"tokenEstimate": 10123,
"language": "en",
"needsOcr": false,
"pagesWithoutText": [],
"ocrPages": null,
"metadata": {
"title": null,
"author": null,
"subject": null,
"keywords": null,
"creator": "LaTeX with hyperref",
"producer": "pdfTeX-1.40.25",
"createdAt": "2024-04-10T21:11:43.000Z",
"modifiedAt": "2024-04-10T21:11:43.000Z",
"pdfVersion": "1.5",
"isEncrypted": false,
"isTagged": null,
"hasForm": false
},
"outputFormat": "markdown",
"splitBy": "chunk",
"text": null,
"markdown": null,
"pages": null,
"chunks": [
{
"index": 3,
"text": "## 1 Introduction\n\nRecurrent neural networks, long short-term memory [13] and gated recurrent [7] neural networks in particular, have been firmly established as state of the art approaches in sequence modeling and transduction problems...",
"charCount": 3150,
"tokenEstimate": 788,
"pageStart": 2,
"pageEnd": 2,
"section": "1 Introduction"
}
],
"links": null,
"headerFooterLinesRemoved": 14,
"truncated": false,
"scrapedAt": "2026-09-23T11:20:05.118Z"
}
FieldDescription
url, finalUrlThe URL you gave and the URL the file was downloaded from after redirects (signed query strings are removed)
fileName, fileType, fileSizeBytesFrom the download headers; fileType is pdf or docx
pageCount, pagesExtractedPages in the file and pages read (after pageRange/maxPages); null for DOCX
charCount, wordCount, tokenEstimateSize of the extracted content (tokens ≈ characters / 4)
languageDetected language (ISO 639-1, e.g. en, de, fr, zh) or null
needsOcr, pagesWithoutTextPages with no text layer; needsOcr is true when they contain images (scans)
ocrPagesPages read with OCR (when ocr is on)
metadataDocument properties (PDF only)
text / markdownFull content for splitBy: "document"
pages[{ page, text, charCount, ocr }] for splitBy: "page"
chunks[{ index, text, charCount, tokenEstimate, pageStart, pageEnd, section }] for splitBy: "chunk"
links[{ url, page }] when extractLinks is on
truncatedtrue if the document was cut to stay within the time limit or the 9 MB dataset item limit

The key-value store also contains:

  • SUMMARY – documents saved and failed, failures by reason, pages, OCR pages, characters, settings and whether the cost limit was reached.
  • FAILED_DOCUMENTS – each URL that was not extracted, with a reason: invalid_url, not_found, access_denied, http_error, timeout, too_large, not_a_pdf, empty_file, password_protected, corrupted, needs_ocr, no_text, page_range_empty or processing_error. These are never charged.

Scanned PDFs and OCR

Every page is checked for a text layer. When a page has almost no text and contains an image, it is a scan:

  • OCR off (default): documents that are mostly scanned (half of the pages or more) are not saved and not charged; they appear in FAILED_DOCUMENTS as needs_ocr. Documents with only a few scanned pages are saved with needsOcr: true and the scanned page numbers in pagesWithoutText.
  • OCR on: pages without a text layer are rendered and read with Tesseract (ocrLanguage), up to ocrMaxPages per document. Each OCRed page is charged as an OCR page. OCR needs at least 1024 MB of memory and takes a few seconds per page, so set the run memory to 1024 MB or more. OCR quality on handwriting and poor scans is limited.

Tables

Tables are detected from the layout of the text (aligned columns across several rows) and output as pipe tables in Markdown or cell | cell rows in text. This works well for simple grids and financial or statistical tables, and rows always stay together, but merged cells, multi-line cells and tables without clear column gaps may be split or joined differently from the original. PDFs have no table structure inside, so treat tables as best-effort.

Pricing

This actor uses pay-per-event pricing: a small fee per run, a fee per document with extracted text (the same price for a 2-page memo and a 200-page report), and a fee per OCR page only when you turn OCR on. You only pay for results – failed downloads, non-PDF links, password-protected, empty and scanned-without-OCR documents are free. Set a maximum cost per run in Apify Console and the actor stops cleanly when it is reached. See the Pricing tab for current prices.

FAQ

Which PDFs work best? Digitally created PDFs (exported from Word, LaTeX, InDesign, report generators) give near-perfect text. Scanned PDFs need OCR.

How do I get SAM.gov attachments? Use the attachment download links from a notice (https://sam.gov/api/prod/opps/v3/opportunities/resources/files/{resourceId}/download). The actor follows the redirect to the signed file. The SAM.gov Contract Opportunities Scraper returns these links for each notice.

Can it read password-protected PDFs? PDFs that only restrict printing or copying open without a password. PDFs that need a password to open are extracted when you set pdfPassword; otherwise they are listed as password_protected for free.

What about very long documents? maxPages (default 200, up to 1000) and pageRange limit the work per document. Dataset items are capped at about 9 MB; bigger outputs are cut and marked truncated: true. Use splitBy: "page" or "chunk" with a pageRange to process a huge document in parts.

Does it support non-English documents? Yes. Text extraction works for any language, including CJK scripts. Language detection covers the main European languages and common scripts. For OCR set ocrLanguage (for example deu or fra).

How much memory should I use? 512 MB is enough for text extraction, including batches of 100+ page reports. Use 1024 MB or more when OCR is on.

Support

Found a PDF that comes out wrong? Open an issue on the actor's Issues tab with the URL – we usually respond within a day.