PDF & Image OCR to Text and Markdown avatar

PDF & Image OCR to Text and Markdown

Pricing

from $0.70 / 1,000 pdf text-layer pages

Go to Apify Store
PDF & Image OCR to Text and Markdown

PDF & Image OCR to Text and Markdown

PDF & image OCR to text and Markdown: reads the PDF text layer and runs Tesseract OCR only on scanned pages and images (PNG, JPG, TIFF, WEBP) in 19 languages. Keeps headings, lists and the ruled tables of digital PDFs. Batch URLs. From $0.001 per text page, $0.005 per OCR page; failed pages free.

Pricing

from $0.70 / 1,000 pdf text-layer pages

Rating

0.0

(0)

Developer

Klarto

Klarto

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

7 hours ago

Last modified

Features

Limited permissions

Share

PDF and image OCR to text and Markdown: give file URLs and get clean, LLM-ready Markdown and plain text for each file. The Actor reads the PDF text layer where there is one and runs Tesseract OCR only on scanned pages and images. $0.001 per text-layer page, $0.005 per OCR page.

Why use it:

  • You pay OCR prices only where OCR is needed. Pages with a usable text layer cost $0.001; blank pages, failed pages and failed files are free.
  • Markdown that keeps the structure: headings from font sizes, bullet and numbered lists, ruled tables of digital PDFs, re-joined hyphenated words, and repeated headers and footers removed.
  • 19 OCR languages with Tesseract 5.5, and scans turned by 90° or 180° are rotated automatically.
  • Batch of up to 1,000 URLs. A bad file does not stop the rest, and each unique URL gets a record with status and error (if a result cannot be saved, a free error record takes its place).
  • Your files stay on Apify. OCR runs inside the Actor's container; files are not sent to outside AI or OCR services.

What it does

  • Input: direct links to PDFs and images (PNG, JPEG, TIFF incl. multi-page, WEBP, BMP, GIF). Dropbox share links and Google Drive file links are converted to direct downloads.
  • Output: one dataset item per unique URL with markdown, text, page counts, OCR confidence and PDF metadata (title, author, creation date). An optional pages list gives each page's text and method, for citations and RAG chunking.
  • Run summary: the OUTPUT record in the key-value store counts files that are ok, partial, failed and skipped, plus text-layer and OCR pages.

How it works

  1. Download. Each URL must be http or https and point to a public address; every redirect is checked too. Connection errors, timeouts, HTTP 429 and 5xx are retried twice (after 2 s and 5 s). Requests send the User-Agent Klarto-DocOCR/0.1 (+https://apify.com/klarto).
  2. File type. It is read from the file's first bytes, not from the extension.
  3. PDF text layer. pdfplumber and pdfminer.six read each page's text, font sizes and ruled tables, with a 60-second limit per page. A page goes to OCR when its text layer is missing or has fewer than 20 characters, when more than 10 % of its glyphs cannot be mapped to letters, or when images cover at least 30 % of the page and the text layer has fewer than 200 characters (a scan with a short stamp).
  4. OCR. The page is rendered at 300 DPI (by default) with pypdfium2 and read by Tesseract 5.5 (LSTM engine) in your languages. Blank pages are detected first and skipped. Orientation detection runs only when the first pass looks poor (confidence below 60 or fewer than 8 words).
  5. Markdown. Font sizes become #, ## and ### headings; bullets and numbers become lists; ruled tables become Markdown tables. On OCR pages, large single lines become headings and the rest becomes paragraphs and lists.
  6. Save, then charge. The item is saved first and its pages are charged after that, so you never pay for a result that was not saved.

Input

FieldDefaultWhat it does
urls(required)Direct links to PDF or image files, up to 1,000 per run. Exact duplicates are read once.
languages["eng"]OCR languages, up to 5: eng, deu, fra, spa, ita, por, nld, pol, ces, ukr, rus, bul, ron, hun, swe, dan, nor, fin, tur. Used on every OCR'd page, in Auto and Always mode.
ocrModeautoauto: text layer first, OCR where needed. always: OCR every page. never: text layer only (images then fail).
pageRangeall pagese.g. 1-3,7,10- (1-based), applied to every document. For a multi-page TIFF it selects frames.
maxPagesPerDocument0 (no cap)Stop after this many pages of each document.
includePagesfalseAdds the per-page pages list.
removeHeadersFooterstrueDrops short blocks (up to 100 characters) at the top or bottom of a page that repeat, digits ignored, on at least max(3, half) of the pages with text.
autoRotatetrueDetects and fixes pages turned by 90°, 180° or 270° before OCR.
ocrDpi300Render resolution for OCR of PDF pages, 150–400.
maxFileSizeMb100Larger files get status error and are not charged; up to 500.
pdfPasswordemptyPassword for encrypted PDFs (tried for every PDF in the run).

Notes on input: Images have no text layer, so never gives them status error. A single image counts as page 1, so a pageRange that leaves out page 1 gives that image an error too. Multi-page TIFFs use the range as frames. For a GIF, only the first frame is read. Exact duplicates are merged before the run starts: the file is read and charged once and gets one item.

Minimal input:

{
"urls": [
"https://www.irs.gov/pub/irs-pdf/fw9.pdf",
"https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
]
}

Output

The two items below come from a real run of the default input on Apify (2026-11-18, build 0.1.13; later builds changed only this README). The W-9 markdown and text are shortened ("…"); the second item is complete.

[
{"url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf", "finalUrl": null, "status": "ok", "error": null,
"fileName": "fw9.pdf", "fileType": "pdf", "fileSizeBytes": 140815, "pageCount": 6, "pagesProcessed": 6,
"pagesTextLayer": 6, "pagesOcr": 0, "pagesEmpty": 0, "pagesFailed": 0, "ocrLanguages": [],
"ocrConfidence": null, "title": "Form W-9 (Rev. March 2024)", "author": "SE:W:CAR:MP",
"createdAt": "2024-03-06T08:18:13-05:00",
"markdown": "Form W-9\n\n(Rev. March 2024)\nDepartment of the Treasury\nInternal Revenue Service\nBefore you begin. For guidance related to the purpose of Form W-9, see Purpose of Form, below.\n\n# Request for Taxpayer Identification Number and Certification\n\n…",
"text": "Form W-9\n\n(Rev. March 2024)\n…", "charCount": 37700, "wordCount": 6230, "truncated": false,
"fullMarkdownUrl": null, "fullTextUrl": null, "note": null, "durationSec": 1.35,
"processedAt": "2026-11-18T13:07:35Z"},
{"url": "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif", "finalUrl": null,
"status": "ok", "error": null, "fileName": "phototest.tif", "fileType": "tiff", "fileSizeBytes": 38668,
"pageCount": 1, "pagesProcessed": 1, "pagesTextLayer": 0, "pagesOcr": 1, "pagesEmpty": 0, "pagesFailed": 0,
"ocrLanguages": ["eng"], "ocrConfidence": 95.5, "title": null, "author": null, "createdAt": null,
"markdown": "This is a lot of 12 point text to test the ocr code and see if it works on all types of file format.\n\nThe quick brown dog jumped over the lazy fox. The quick brown dog jumped over the lazy fox. The quick brown dog jumped over the lazy fox. The quick brown dog jumped over the lazy fox.\n",
"text": "This is a lot of 12 point text to test the ocr code and see if it works on all types of file format.\n\nThe quick brown dog jumped over the lazy fox. The quick brown dog jumped over the lazy fox. The quick brown dog jumped over the lazy fox. The quick brown dog jumped over the lazy fox.\n",
"charCount": 286, "wordCount": 60, "truncated": false, "fullMarkdownUrl": null, "fullTextUrl": null,
"note": null, "durationSec": 0.47, "processedAt": "2026-11-18T13:07:36Z"}
]
FieldTypeMeaning
urlstringThe URL from your input.
finalUrlstring or nullWhere the file was downloaded from after share-link conversion and redirects; null if the same as url, or if the file could not be downloaded or opened.
statusstringok, partial, error or skipped (see below).
errorstring or nullPlain-English reason for error, skipped or partial.
fileName, fileType, fileSizeBytesstring, string, integerName sent by the host (Content-Disposition), else from the URL path; type detected from the content (pdf, png, jpeg, tiff, webp, bmp, gif); downloaded size. For a file that could not be downloaded or opened, fileName comes from the URL path (e.g. view for a failed Drive link) and the type and size are null.
pageCountintegerPages in the PDF or frames in the TIFF (1 for other images; 0 if the file was not read).
pagesProcessedintegerPages with a result, after pageRange and maxPagesPerDocument.
pagesTextLayerintegerPages read from the text layer (charged as page).
pagesOcrintegerPages or images read with OCR (charged as ocr-page).
pagesEmpty, pagesFailedintegerBlank pages and failed pages (both free).
ocrLanguagesarrayOCR languages used; empty when nothing was OCR'd.
ocrConfidencenumber or nullMean Tesseract word confidence, 0–100, over the OCR'd pages.
title, author, createdAtstring or nullFrom the PDF metadata. createdAt is ISO 8601 with the PDF's time zone (e.g. -05:00, or Z for UTC); without a zone in the PDF it has no suffix.
markdown, textstringThe document as Markdown and as plain text.
charCount, wordCountintegerSize of the full plain text.
truncated, fullMarkdownUrl, fullTextUrlboolean, string or nullFor very large documents (see below).
notestring or nullExtra information, e.g. that the per-page list was left out.
pagesarrayOnly with includePages: page (number), method (text, ocr, empty or error), ocrConfidence (0–100 or null), text, error.
durationSec, processedAtnumber, stringSeconds spent on the file; when the item was saved (UTC).
  • status:
    • ok: every selected page was read or was blank;
    • partial: some pages failed, or the charge limit or the run timeout stopped the file midway (error says which);
    • error: the file could not be read, e.g. HTTP 404, too large, damaged, wrong password;
    • skipped: not read because the charge limit was reached or the run was close to its timeout. Files the run had no time to start get a skipped item too. Skipped files are free.
  • Every item has the same fields. If a file was not downloaded or not opened (an HTTP error, the size limit, a damaged or locked file, an unsupported type, a page range that selects no pages, or a file the run did not start), the page counts are 0, markdown and text are empty, and fileType, fileSizeBytes, title and the other file details are null. A file that was opened but stopped by the charge limit or the run timeout before its first page, or whose pages all failed, keeps its fileType, pageCount and metadata. pages is present only with includePages and only for files that were opened.
  • Very large documents: if an item would be larger than about 8 MB, markdown and text keep the first 100,000 characters, truncated is true, and fullMarkdownUrl and fullTextUrl link the full files in the run's key-value store. The pages list is then left out.
  • Files follow Apify data retention; copy them if you need permanent links.
  • Output tabs: "Documents" shows status, page counts, confidence and the Markdown; "Markdown and text" shows both texts; "Run summary" is the OUTPUT record.

Pricing

EventPrice
page: a page read from the PDF text layer$0.001
ocr-page: a page or image read with OCR$0.005

Paid Apify plans pay less. Apify Store discounts apply automatically: Bronze 10% off, Silver 20% off, Gold and higher 30% off. The prices above are Free-plan prices; the Store card shows the lowest (Gold) price. The start event (apify-actor-start) has no discount.

  • Free: blank pages, failed pages, files with status error or skipped, and dataset items.
  • Apify start event: apify-actor-start costs $0.00005 per GB of run memory, i.e. $0.0001 per run at the default 2 GB.
  • Examples:
    • 1,000 text-layer pages: 1,000 × $0.001 = $1.00;
    • 1,000 scanned pages: 1,000 × $0.005 = $5.00;
    • a 40-page digital PDF: $0.04 when every page has a usable text layer. A page that is mostly a picture (images on at least 30 % of the page and fewer than 200 characters of text) is OCR'd at $0.005; with 2 such pages the file costs 38 × $0.001 + 2 × $0.005 = $0.048.
  • Charge limit: set "Maximum cost per run" in the run options. The Actor reserves each page's price before reading it, so it stops before going over: the file in progress becomes partial (or skipped if none of its pages was read yet) and the remaining files skipped.

Limits

  • Per run: up to 1,000 URLs and 5 OCR languages.
  • File size: 100 MB by default (maxFileSizeMb), up to 500 MB.
  • Image size: the decode limit depends on memory and color mode. At 2 GB it is about 200 megapixels for grayscale, 160 for RGB and 120 for other modes (RGBA, CMYK, palette); larger images get status error. Before OCR, images and rendered PDF pages above 40 megapixels are scaled down to 40.
  • Time per page: 60 s to read a page's text layer (after that, Auto mode OCRs the page) and 180 s per OCR pass.
  • Run timeout: the Actor stops 90 s before the timeout (20 % of the timeout for short runs), saves what is done, and lists the files it could not start as skipped. Raise the timeout or split the list for large jobs.
  • Speed, measured on Apify (2026-11-18):
    • a dense two-column scanned page (about 4,700 characters): about 12 s at the default 2 GB and about 3 s at 8 GB (4 pages: 47 s and 12 s);
    • a 6-page digital PDF (IRS Form W-9): 1.3 s at 2 GB;
    • on that test scan this means about 300 scanned pages per hour at 2 GB and about 1,200 at 8 GB, in one run. Other scans can be slower or faster.
    • Your price per page is the same at any memory; only the start event grows ($0.0004 at 8 GB). So choose 8 GB for large scans.
  • Memory and CPU: Apify gives more CPU to runs with more memory. Pages are OCR'd one at a time up to 8 GB, and two at a time from 16 GB.
  • Not supported: handwriting, math formulas, complex charts, and tables in scans (they come out as plain text).

Use it from your stack

You need no third-party API keys, only an Apify account and its API token.

  • API (curl):
    curl -X POST "https://api.apify.com/v2/acts/klarto~pdf-ocr-markdown/run-sync-get-dataset-items" \
    -H "Authorization: Bearer YOUR_APIFY_TOKEN" -H "Content-Type: application/json" \
    -d '{"urls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"]}'
    This call waits at most 300 s; a longer run returns HTTP 408. For big jobs, start the run and read the dataset when it has finished:
    curl -X POST "https://api.apify.com/v2/acts/klarto~pdf-ocr-markdown/runs" \
    -H "Authorization: Bearer YOUR_APIFY_TOKEN" -H "Content-Type: application/json" \
    -d '{"urls": ["https://example.com/scan-1.pdf", "https://example.com/scan-2.pdf"]}'
    # the response has data.id (the run ID); wait until data.status is SUCCEEDED or FAILED
    # (each file's row has status and error; FAILED only for invalid input or a run timeout too short for any file):
    curl "https://api.apify.com/v2/actor-runs/RUN_ID?waitForFinish=60" -H "Authorization: Bearer YOUR_APIFY_TOKEN"
    curl "https://api.apify.com/v2/actor-runs/RUN_ID/dataset/items?format=json" -H "Authorization: Bearer YOUR_APIFY_TOKEN"
  • Python (pip install apify-client, version 3):
    from apify_client import ApifyClient
    client = ApifyClient("YOUR_APIFY_TOKEN")
    run = client.actor("klarto/pdf-ocr-markdown").call(run_input={"urls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"]})
    print(client.dataset(run.default_dataset_id).list_items().items[0]["markdown"])
  • n8n: the Apify node → Run an Actor → klarto/pdf-ocr-markdown, then read the dataset items.
  • Make and Zapier: the Apify app → Run an Actor, with klarto/pdf-ocr-markdown.
  • MCP / AI agents: https://mcp.apify.com?tools=klarto/pdf-ocr-markdown. The Actor takes an array of URLs and returns Markdown, and every item has status and error, so an agent can see which files failed and why.

FAQ

How do I get a direct link from Dropbox or Google Drive? Paste the share link as it is. A Dropbox link (https://www.dropbox.com/...?dl=0) is changed to dl=1, which Dropbox serves as a download. A Google Drive file link (https://drive.google.com/file/d/<FILE_ID>/view) is changed to https://drive.google.com/uc?export=download&id=<FILE_ID>. The Drive file must be shared as "Anyone with the link". Google Docs documents and Drive files too large for a direct download return a web page, and the item gets an error that says so; use another direct link then.

Does it read tables? Yes, from digital PDFs: tables drawn with ruled lines become Markdown tables. Tables without lines and tables in scans come out as plain text.

Why was my digital PDF charged as OCR pages? In Auto mode a page is OCR'd ($0.005) when its text layer cannot be used: it is missing, has fewer than 20 characters, has more than 10 % of glyphs that do not map to letters, could not be read within 60 s, or the page is mostly a picture (images on at least 30 % of the page and fewer than 200 characters of text). pages[].method shows which pages were OCR'd. Choose never to read only the text layer.

My scanned PDF was charged as text pages. Why? Many scans already contain an OCR text layer, e.g. from the scanner software or archive.org. Auto mode reads that layer ($0.001 per page). Choose always if that layer is poor and you want Tesseract to read the page images.

How accurate is it? It depends on the scan. In our runs the mean word confidence (ocrConfidence) was 95.5 on the Tesseract test page above and 94.5 on a 1965 two-column scan. Check ocrConfidence per file, or per page with includePages: low values point to poor scans, and 400 DPI can help with tiny print.

Can it read password-protected PDFs? Yes, with pdfPassword. Without the right password the file gets status error and is free.

Is my data private? Files are downloaded to the run's temporary disk, read, and deleted after each file. Results stay in your own Apify dataset and key-value store. Only public addresses are fetched; private and internal network addresses are refused.

Do I pay for files that fail? No. Files with status error or skipped, failed pages and blank pages are not charged.

Fair use and licences

  • Process only files you own or have the right to process.
  • Open-source parts: Tesseract OCR and its language data (Apache-2.0, Debian packages), pytesseract (Apache-2.0), pdfplumber (MIT), pdfminer.six (MIT), pypdfium2 (Apache-2.0 or BSD-3-Clause) with PDFium (BSD-3-Clause), Pillow (MIT-CMU), httpx (BSD-3-Clause).

Ready-made examples

Saved inputs for common jobs: open one and run it as it is, or change the input first.

Support

Open an issue on the Actor page. We aim to answer within a week.