Menhly ToolsAll tools

PDF to Text Extractor + OCR for Scanned PDFs

PDF to text from URLs, $2 per 1,000 PDFs, with automatic OCR for scanned pages. One flat row per URL, never null, only successful PDFs billed. Fast, low-memory engine; Google Drive, Dropbox and arXiv links accepted. Built for pipelines and AI agents.

This tool runs on Apify: pay only for the results you get, with a free monthly credit on new accounts.

Try it on Apify

Give it PDF links, get back the text. Pages that are scans or photos are read with OCR automatically; pages that already have text are never OCRed. One flat row per URL, every field always present, never null — built to be called from pipelines, n8n/Make/Zapier flows and AI agents.

$2 per 1,000 PDFs. $5 per 1,000 OCR pages. Failed downloads, broken files and PDFs with no text are free.

Why this one

Input

Field Default What it does
urls — PDF links, one per line. Required.
ocrMode auto auto OCRs only pages with no text layer that contain an image. off never OCRs.
ocrLanguage eng Tesseract language code; join several with + (eng+fra). 30 languages are built in, including vie, chi_sim, jpn, kor, ara, hin.
maxOcrPagesPerPdf 50 Cost cap for huge scanned books. Pages over the cap come back empty and are listed in notes.
pageRange all 1-5, 8, 12- style. A range that selects no page fails that row, uncharged.
includePages false Adds pages[] with per-page text and an ocr flag, for page-level citations.
chunkSize / chunkOverlap 0 / 200 RAG chunks of about chunkSize characters, each with pageStart and pageEnd. 0 turns chunking off.
password — Used for every PDF in the run that needs one.
maxFileSizeMb 100 Larger files fail as too_large, uncharged.
downloadTimeoutSecs 30 Total time allowed for one download. Slower URLs fail as download_timeout, uncharged. Raise it for huge files on slow hosts.
{
  "urls": ["https://arxiv.org/abs/1706.03762", "https://www.irs.gov/pub/irs-pdf/f1040.pdf"],
  "ocrLanguage": "eng",
  "chunkSize": 1500
}

Output

One row per input URL, in completion order. Use inputIndex to line rows up with your input.

{
  "inputIndex": 0,
  "url": "https://arxiv.org/abs/1706.03762",
  "resolvedUrl": "https://arxiv.org/pdf/1706.03762.pdf",
  "fileName": "1706.03762.pdf",
  "status": "ok",
  "subStatus": "text_layer",
  "error": "",
  "pageCount": 15, "pagesExtracted": 15, "ocrPages": 0, "scannedPages": 0,
  "charCount": 39598, "wordCount": 6099,
  "text": "Attention Is All You Need\nAshish Vaswani∗\nGoogle Brain\n…",
  "textTruncated": false, "fullTextUrl": "",
  "pages": [], "chunks": [],
  "title": "", "author": "", "subject": "", "keywords": "", "creator": "LaTeX with hyperref", "producer": "pdfTeX-1.40.25",
  "creationDate": "2024-04-10T21:11:43Z", "modDate": "2024-04-10T21:11:43Z",
  "pdfVersion": 15, "isEncrypted": false, "fileSizeBytes": 2215244,
  "notes": [], "processingMs": 218
}

Strings are "" when absent, numbers 0, arrays []. No field is ever null or missing.

Status

status subStatus Charged
ok text_layer — all text came from the PDF itself PDF
ok ocr — some or all pages were read by OCR PDF + each OCR page
ok ocr_incomplete — some scanned pages were not read (page cap, cost limit, OCR off, OCR failure); see notes PDF + each OCR page
ok budget_incomplete — a very long PDF was stopped part-way (see Fair use); notes says where PDF + each OCR page
no_text no_text_layer, scanned_ocr_off, ocr_found_nothing free
failed http_404 (any http_<code>), not_a_pdf, too_large, download_timeout, download_error, password_required, wrong_password, unsupported_encryption, corrupt_pdf, empty_document, bad_page_range, page_range_out_of_bounds, invalid_url, cost_limit_reached, free_work_limit, extraction_error free

Very large documents: if a row would exceed Apify's dataset item limit, the full text is saved to the run's key-value store and linked from fullTextUrl. text keeps the first 1,000,000 characters and textTruncated is true.

Pricing

Event Price When
pdf-extracted $0.002 A PDF returned text (status: "ok")
ocr-page $0.005 A scanned page whose text was recovered by OCR

The only other charge is a start fee per run: $0.0025 per GB of memory from 7 November 2026 ($0.005 per run at the default 2 GB, $0.0025 at 1 GB), $0.00005 per GB until then. Prices drop on higher Apify plans: down to $1.50 per 1,000 PDFs and $3.50 per 1,000 OCR pages on Gold. A run stops starting new PDFs when your maximum cost per run is reached, and marks the rest cost_limit_reached, uncharged.

Fair use

Failed and empty rows are free, which only works if nobody can turn free rows into unlimited work. So:

What it does not do (yet)

Honest limits, so you can decide before you run it:

Use it from AI agents (MCP)

This Actor is a tool on the Apify MCP server, so Claude, Cursor, VS Code or any MCP client can call it to read a PDF. Load only this tool: a short tool list keeps the agent from picking the wrong one.

Recommended: hosted server, OAuth sign-in (nothing secret on disk). Add to your MCP client config (claude_desktop_config.json, .cursor/mcp.json, …):

{
  "mcpServers": {
    "pdf-text-extractor": {
      "url": "https://mcp.apify.com?tools=sumitr_mardy/pdf-text-extractor"
    }
  }
}

With an API token instead (clients without OAuth, or unattended setups):

{
  "mcpServers": {
    "pdf-text-extractor": {
      "url": "https://mcp.apify.com?tools=sumitr_mardy/pdf-text-extractor",
      "headers": { "Authorization": "Bearer YOUR_APIFY_TOKEN" }
    }
  }
}

Local server (stdio):

{
  "mcpServers": {
    "pdf-text-extractor": {
      "command": "npx",
      "args": ["-y", "@apify/actors-mcp-server@latest", "--tools", "sumitr_mardy/pdf-text-extractor"],
      "env": { "APIFY_TOKEN": "YOUR_APIFY_TOKEN" }
    }
  }
}

The hosted server also gives the agent this Actor's output schema, so it knows every field before the first call. apify mcp install <client> writes the config for you if you use the Apify CLI. Get a token at Apify Console → API & Integrations, and never commit it.

Tips for agents:

Use it from code

from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("sumitr_mardy/pdf-text-extractor").call(run_input={
    "urls": ["https://www.irs.gov/pub/irs-pdf/f1040.pdf"],
})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row["status"], row["subStatus"], row["charCount"])
curl -X POST "https://api.apify.com/v2/acts/sumitr_mardy~pdf-text-extractor/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://arxiv.org/abs/1706.03762"]}'