PDF OCR & Image to Text: Scanned PDFs to Text & Markdown avatar

PDF OCR & Image to Text: Scanned PDFs to Text & Markdown

Pricing

from $2.80 / 1,000 ocr page or images

Go to Apify Store
PDF OCR & Image to Text: Scanned PDFs to Text & Markdown

PDF OCR & Image to Text: Scanned PDFs to Text & Markdown

Extract text or Markdown from PDFs, scans, photos, Word, PowerPoint, Excel and EPUB files for LLM and RAG. Reads the PDF text layer first and runs OCR only on scanned pages and images, in 49 languages. One row per page, slide, sheet or chunk with token counts, plus each document's full text.

Pricing

from $2.80 / 1,000 ocr page or images

Rating

0.0

(0)

Developer

Actor Factory

Actor Factory

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Features

Limited permissions

Share

This PDF OCR and image to text actor extracts text from PDFs, scanned documents, photos and screenshots, and converts Word, PowerPoint, Excel and EPUB files to text or Markdown, in one run. Give it file URLs. For each PDF page it reads the text layer directly when there is one (exact and cheap) and runs Tesseract OCR only on pages that are scanned images. Images (PNG, JPEG, WebP, GIF, BMP, TIFF) are always OCR'd. You get one row per page, slide, sheet or chapter with the text, word and token counts, OCR confidence and document metadata, plus each document's full text as one file. Switch on PDF to Markdown (headings, lists, tables) and RAG chunks with heading paths for LLM, RAG and vector-search pipelines. 49 OCR languages, including German, French, Spanish, Arabic, Hindi, Chinese, Japanese and Korean. No API key and no external OCR or AI service: everything runs inside the actor.

What OCR and document data you get

FieldDescription
urlThe file URL you gave
file_name, file_type, file_size_bytesFile name (from the URL or download headers), detected type (pdf, png, jpeg, docx, pptx, xlsx, epub, csv, txt, md, html, ...) and size
page, page_countPDF page number (1-based) and pages in the file; for other documents the slide, sheet or chapter number and how many were read (1 for images)
sectionSlide title, sheet name or chapter title; for chunks, the heading path such as Methods > Data
methodtext-layer (read from the PDF), ocr (recognised by Tesseract), document (Word, PowerPoint, Excel, EPUB, text or web page converted), mixed (a chunk spanning text-layer and OCR pages) or none (file could not be read)
text_formattext or markdown
textThe page, section or chunk text: plain text with blank lines between paragraphs, or Markdown
char_count, word_count, token_countSize of the text; tokens counted with OpenAI's o200k_base tokenizer (GPT-4o and later)
ocr_confidenceTesseract's mean word confidence, 0 to 100 (OCR rows only)
languagesOCR languages used for the page
width_px, height_pxSize of the image that was OCR'd
title, author, created_atDocument metadata (PDF, Office, EPUB or web page), when the file has it
page_end, chunk_index, chunk_countFor chunks: last page covered, chunk number and chunks in the document
statusok (text found), empty (blank page) or error
errorWhy a file or page could not be read (download failed, password-protected PDF, unsupported file type, ...)
full_text_urlLink to the whole document's text as one file (with Save each document's full text)
scraped_atWhen the file was processed (ISO 8601)

Which files can it read?

  • PDF: digital PDFs (text layer) and scanned PDFs (OCR), page by page.
  • Images: PNG, JPEG, WebP, GIF, BMP, TIFF, read with OCR.
  • Word (DOCX): headings, paragraphs, lists, tables and links, as one row per document.
  • PowerPoint (PPTX): one row per slide with the slide title, text, bullet lists, tables and speaker notes. Hidden slides are skipped.
  • Excel (XLSX): one row per sheet as a table, with dates and the stored values of formulas. Very large sheets are split into parts.
  • EPUB e-books: one row per chapter in reading order, with chapter titles from the table of contents.
  • CSV, TXT and Markdown files.
  • Web pages (HTML), only when Convert web pages is on: the main content of the page (Mozilla Readability), one page per URL.

The file type is detected from the file's bytes, so links without an extension work too.

How to extract text from a PDF, image or Word file

InputDescription
fileUrlsDirect links to the files, one per line. Public links only: S3, Google Cloud Storage, Dropbox ?dl=1 links, Apify key-value store records, your own website
outputFormattext (default) or markdown
languagesOCR language(s) of your documents (default English, up to 5). The PDF text layer and other documents are read in any language
ocrModeauto (default): text layer when the page has one, OCR otherwise. always: OCR every page. never: text layer only
pageRangePages to read from each PDF, e.g. 1-3, 5, 10-. Empty means all pages
maxPagesPerFileStop reading a PDF after this many pages, or a document after this many slides, sheets or chapters (default 200)
chunkSize0 (default) for one row per page or section; e.g. 512 for RAG chunks of up to 512 tokens (64 to 8,192)
chunkOverlapTokens repeated from the previous chunk when a section is split for size (default 50)
convertWebPagesConvert links that return a web page instead of a file (default off: such links give a free error row)
dpiRendering resolution for scanned PDF pages (default 200; 300 for very small print)
saveFullTextSave each document's text as one file and link it in full_text_url (default on, free)
maxPagesTotal cap on charged pages, images and documents across all files
{
"fileUrls": [
"https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/testocr.png",
"https://upload.wikimedia.org/wikipedia/commons/d/d3/Farm_broadcasters_letter_%28IA_CAT82764458246%29.pdf",
"https://raw.githubusercontent.com/apache/poi/trunk/test-data/slideshow/SampleShow.pptx"
],
"languages": ["eng"],
"ocrMode": "auto",
"outputFormat": "markdown",
"maxPages": 100
}

PDF to Markdown and RAG chunks for LLMs

With outputFormat: markdown:

  • PDF pages get # headings from font sizes (up to three levels, measured against the document's body text), bullet and numbered lists, and paragraphs joined across line breaks with hyphenated words repaired. Running headers, footers and page numbers that repeat on most pages are removed.
  • Scanned pages and images get joined paragraphs and lists from the OCR text.
  • Word, PowerPoint, Excel and EPUB files keep their headings, lists, links and tables as Markdown tables.

With chunkSize set (for example 512), each document becomes chunks of at most that many tokens instead of pages. Chunks break at headings first, then at paragraphs, then at sentences, and long tables repeat their header row. Each chunk carries its heading path in section, the pages it covers in page and page_end, and its token_count, ready to embed and load into Pinecone, Qdrant, Weaviate, pgvector or any vector store. Token counts use OpenAI's o200k_base tokenizer; other models' tokenizers give similar counts.

Output example

A scanned image read with OCR (plain text):

{
"url": "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/testocr.png",
"file_name": "testocr.png",
"file_type": "png",
"file_size_bytes": 23359,
"page": 1,
"page_end": null,
"page_count": 1,
"section": null,
"method": "ocr",
"text_format": "text",
"text": "This is a lot of 12 point text to test the\nocr code and see if it works on all types\nof file format.\n\nThe quick brown dog jumped over the\nlazy fox. The quick brown dog jumped\nover the lazy fox. ...",
"char_count": 285,
"word_count": 60,
"token_count": 73,
"ocr_confidence": 94,
"languages": ["eng"],
"width_px": 640,
"height_px": 480,
"title": null,
"author": null,
"created_at": null,
"chunk_index": null,
"chunk_count": null,
"status": "ok",
"error": null,
"full_text_url": "https://api.apify.com/v2/key-value-stores/.../records/text-0001-testocr?signature=...",
"scraped_at": "2026-11-16T06:40:03.405Z"
}

A RAG chunk of a Word file (Markdown, chunkSize: 300):

{
"url": "https://assets.publishing.service.gov.uk/media/65f1a247981227a772f6136e/request-flexible-working-docx-form.docx",
"file_name": "request-flexible-working-docx-form.docx",
"file_type": "docx",
"page": 1,
"page_end": 1,
"page_count": 1,
"section": "The right to request flexible working > Form FW(A): Flexible working application form > Note to the employer",
"method": "document",
"text_format": "markdown",
"text": "### Note to the employer\n\nThis is a formal application made under the legal right to apply for flexible working ...",
"token_count": 137,
"created_at": "2024-03-13T12:54:00.000Z",
"chunk_index": 2,
"chunk_count": 6,
"status": "ok"
}

The Pages and sections view in the Output tab shows one row per page or section, RAG chunks shows the chunk columns, and Text only shows the text and the full-text links. The run's OUTPUT record has totals (files read, pages from the text layer, pages OCR'd, documents converted, chunks, blank pages, errors).

How much does PDF OCR cost?

Pay per event, only for pages and documents that produced text:

  • $4.00 per 1,000 OCR pages or images (ocr-page): a scanned PDF page or an image read by OCR.
  • $0.20 per 1,000 text-layer pages (text-page): a PDF page whose text was read directly, so a 50-page digital PDF costs $0.01.
  • $2.00 per 1,000 documents (document): one Word, PowerPoint, Excel, EPUB, CSV, text or web page file converted, whatever its length.
  • A tiny start fee per run. Markdown, token counts and chunks cost nothing extra: you pay per page or document, never per chunk. Blank pages, failed downloads and unreadable files are free. Volume discounts apply on higher Apify plans.

Examples: 1,000 scanned invoices (one page each) cost about $4. A 300-page digital report costs $0.06, as text or as Markdown chunks. 1,000 Word or PowerPoint files cost $2. With ocrMode: auto, you only pay the OCR price for pages that really need OCR. Use maxPages to cap the cost of a run.

Use cases

  • Turn scanned contracts, letters, invoices and receipts into searchable text
  • Convert PDFs, Word files, slide decks and spreadsheets into Markdown chunks for RAG, vector search and LLM fine-tuning
  • Read text from screenshots, photos of documents and scanned forms
  • Bulk-extract text from report archives, court filings, public records and research papers
  • Count tokens per page or document before sending files to an LLM
  • Check which PDFs in a collection are scans without a text layer (method: ocr)

Limits & notes

  • Accuracy: Tesseract reads printed text well (typically 90 to 98% of words on clean scans at 200 dpi). Handwriting, very low-resolution photos, heavy noise and rotated pages (sideways or upside down) give poor results. Tables in PDFs and scans come out as text lines, not cells (tables in Word, PowerPoint and Excel files keep their cells).
  • PDF Markdown is rebuilt from font sizes and positions: headings, lists and paragraphs are reliable on reports, papers and books; complex layouts (forms, multi-column magazines, figures with labels) can mix text from neighbouring blocks.
  • Speed: a text-layer page or a document takes a fraction of a second; an OCR page takes about 3 to 20 seconds depending on how much text it has. With more memory the actor runs more OCR workers in parallel (one per 4 GB, up to 4).
  • Files: up to 200 MB each. Password-protected PDFs and encrypted Office files cannot be read. Old binary formats (.doc, .ppt, .xls), OpenDocument (.odt, .ods, .odp) and RTF are not supported: save them as DOCX, PPTX, XLSX or PDF. Images inside Word and PowerPoint files are not OCR'd. Excel sheets are read up to 10,000 rows and 200 columns each.
  • Links must return the file itself. A web page (such as a PDF viewer) gives a free error row with a hint, unless Convert web pages is on.
  • Only the files you list are downloaded. The actor does not crawl. It obeys each host's robots.txt (token PdfOcrText), paces requests per host and identifies itself with one fixed user agent. Only process files you have the right to use.
  • Files are processed in memory and are not kept. The text is stored only in your own run's dataset and key-value store.
  • Languages other than English are downloaded once per run from the official tesseract.js language packages. Picking several languages makes OCR slower; pick only the ones in your documents.

Integrations and API

Run it from your own code with the Apify API or the official Python and JavaScript clients:

from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("actorfactory/pdf-ocr-text").call(run_input={
"fileUrls": [
"https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/testocr.png",
"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
],
"outputFormat": "markdown",
"chunkSize": 512,
"maxPages": 10,
})
for chunk in client.dataset(run["defaultDatasetId"]).iterate_items():
print(chunk["file_name"], chunk["section"], chunk["token_count"], chunk["text"][:80])
  • Process files from your own storage: upload files to an Apify key-value store (or S3) and pass their URLs; or call the actor from a webhook whenever a new document arrives.
  • Load chunks into a vector database with Apify's Pinecone, Qdrant or Weaviate integrations, or with LangChain and LlamaIndex loaders for Apify datasets.
  • Schedule it in Apify Console and send results to Google Sheets, Slack, email or a webhook, or connect it to Make, Zapier or n8n.
  • Use it from AI agents (Claude, ChatGPT, Cursor) through the Apify MCP server, so an agent can read any PDF, scan or Office file by URL.
  • Export results as JSON, CSV, Excel or HTML from the Output tab, or read them from the dataset API.

FAQ

Does it OCR every page? No, not in the default auto mode. Digital PDFs already contain their text, which is read directly and billed at the cheap text-layer price. OCR runs only on scanned pages, on pages whose text layer is garbled, and on scans that carry nothing but a stamp or page number as text. Set ocrMode: always to OCR every page anyway.

Which languages are supported? 49, including English, German, French, Spanish, Italian, Portuguese, Dutch, Polish, Czech, Russian, Ukrainian, Turkish, Greek, Arabic, Hebrew, Persian, Hindi, Bengali, Tamil, Thai, Vietnamese, Indonesian, Chinese (simplified and traditional), Japanese and Korean. Pick the languages of your documents in languages.

Can it convert PDF, Word, PowerPoint and Excel files to Markdown? Yes. Set Output format to Markdown. PDFs get headings, lists and joined paragraphs; Word, PowerPoint, Excel and EPUB files keep their headings, lists and tables. The price is the same as plain text.

How are RAG chunks priced? Chunks are free. You pay for the pages (PDF, OCR) or documents (Word, PowerPoint, Excel, EPUB, text, web page) that were read, whatever the chunk size.

Can I read files that are not public? Use any link the actor can download without logging in, such as an S3 pre-signed URL or a key-value store record URL. Files behind a login page cannot be read.

What do I pay for blank pages or broken links? Nothing. Blank pages come back as status: empty, failed files as status: error with the reason, and neither is charged.

How do I get one text per document instead of per page? Keep Save each document's full text on: every row links its document's whole text (plain text or Markdown) in full_text_url, and the files are listed in the run's key-value store.

Does it crawl websites? No. It reads the files and pages you list. To find PDF and Office links on a site first, use the Sitemap URL Extractor and pass the links here.