# Image & PDF to Text OCR: Scans, Photos, Chinese, Japanese (`stfgdev/image-pdf-ocr`) Actor

Extract text from images, photos, screenshots and scanned PDFs: Chinese, Japanese, English and 45+ Latin-script languages in one model, plus Korean, Cyrillic, Arabic, Hindi, Thai. Runs inside your run, no outside OCR API. $0.003 per page.

- **URL**: https://apify.com/stfgdev/image-pdf-ocr.md
- **Developed by:** [STFG](https://apify.com/stfgdev) (community)
- **Categories:** AI, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 recognised pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Image & PDF to Text (OCR): scans, photos and screenshots, strong in Chinese and Japanese

Turn images and PDFs into plain text. Paste links to photos, screenshots, scanned documents or PDF files and get the text of every page, in reading order, plus a `.txt` file per document.

- **Chinese, Japanese, English and 45+ Latin-script languages in one model**, also mixed on one page (a Hong Kong menu, a Japanese label with English, a Vietnamese invoice). Simplified and Traditional Chinese both work.
- **Korean, Cyrillic, Arabic, Hindi (Devanagari), Thai, Greek, Tamil and Telugu** with their own models: pick the script in **Script / language**.
- **PDFs done the cheap way first**: pages that already contain text are read directly (exact, $0.0005 per page); only scanned pages are recognised.
- **Private**: recognition runs inside your run with open PaddleOCR models. Your files are **not sent to any outside OCR or AI service**, and they are deleted when the run ends.
- **Google Drive, Dropbox and OneDrive links** work, as well as direct file links.
- **$0.003 per page** recognised. Failed files are not charged.

### Try it

The form is pre-filled with a sample receipt in Chinese, English and Japanese. Press **Start**; it costs one page ($0.003).

### What you get

One result per file. This is the real output for the sample receipt (uncorrected: 燒 came out in its simplified form 烧, and the space before "Matcha" is missing):

```json
{
  "status": "ok",
  "fileType": "image",
  "pagesRead": 1,
  "ocrPages": 1,
  "textLayerPages": 0,
  "text": "星光茶餐廳 Starlight Café\n香港九龍彌敦道123號\nTel: 2345 6789 2026-11-26 13:42\n凍檸茶 Iced Lemon Tea HK$ 24.00\n菠蘿油 Pineapple Bun HK$ 18.00\n叉烧飯 BBQ Pork Rice HK$ 52.00\n抹茶ラテMatcha Latte HK$ 36.00\n合計 Total HK$ 130.00\n多謝光臨！Thank you, see you again.\nありがとうございました",
  "pages": [
    { "page": 1, "method": "ocr", "lineCount": 15, "averageConfidence": 0.974, "width": 926, "height": 1270, "text": "..." }
  ],
  "txtUrl": "https://api.apify.com/v2/key-value-stores/.../records/text-001-....txt"
}
```

Turn on **Include line positions** to get every line with its confidence and its four corner points, for highlighting or rebuilding a layout.

### What you can paste in

| Link type | Example |
|---|---|
| Image | `https://example.com/receipt.jpg`: JPEG, PNG, WebP, BMP, GIF, TIFF (every frame of a multi-page TIFF) |
| PDF | `https://example.com/contract.pdf`, scanned or digital, up to 300 MB |
| Google Drive file | `https://drive.google.com/file/d/.../view?usp=sharing` (sharing: "Anyone with the link") |
| Dropbox file | `https://www.dropbox.com/scl/fi/.../scan.pdf?rlkey=...&dl=0` |
| OneDrive / SharePoint file | `https://1drv.ms/...` or a SharePoint file share link |
| A file you uploaded | The public link of a record in an Apify key-value store |

Links must point at the file itself, not at a web page that shows it.

### Price

- **Recognised page: $0.003 per page** ($3 per 1,000): each image, each TIFF frame, and each PDF page that had to be recognised.
- **PDF page with its own text: $0.0005 per page** ($0.50 per 1,000): pages whose text is read straight from the PDF.

You pay only after the result is saved; files that fail are free. Set **Maximum pages per file**, or a maximum charge for the run, and the tool stops within it.

### How accurate is it?

From our own tests:

- **Printed text** (documents, receipts, labels, screenshots, slides): very reliable, including mixed Chinese/English/Japanese lines.
- **Photos** at an angle, in poor light or with curved pages: usually fine; small or blurry text can be missed. Lower **Minimum confidence** to keep more of it.
- **Handwriting** is not what these models are made for: expect gaps.
- **Layout**: text comes back row by row, top to bottom. Pages with several columns or complex tables come out row by row across the columns; use **Include line positions** if you need the geometry.
- Spaces between Chinese/Japanese and Latin text are sometimes dropped ("ラテMatcha").

### Use it from code or an AI agent

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("stfgdev/image-pdf-ocr").call(run_input={
    "sources": ["https://example.com/scan.pdf", "https://example.com/receipt.jpg"],
})
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item["status"], item.get("pagesRead"), item.get("text", "")[:200])
```

The Actor also works as a tool for AI agents through the Apify MCP server.

### Your files and privacy

- Files are downloaded inside your run, read there, and deleted when the run ends.
- Text recognition runs inside the run itself; nothing is sent to an outside service, and nothing is used for training.
- Results are stored only in your own Apify storage, under your account's retention settings.
- It needs **limited permissions** only: it cannot read anything else in your Apify account.

You are responsible for having the right to process the files you submit.

### Questions

- **Can it read a whole book?** Yes: set **Maximum pages per file** (up to 2,000). A digital PDF is read from its text layer at $0.0005 per page.
- **The output is empty.** The image may have no text, or text below **Minimum confidence**; try 0.3. For Korean, Cyrillic, Arabic or Indic text, choose the script first.
- **Does it translate?** No, it returns the text as written.

### Credits

Text recognition by [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) PP-OCRv6 and PP-OCRv5 models (Apache-2.0), run with [RapidOCR](https://github.com/RapidAI/RapidOCR) (Apache-2.0) and [ONNX Runtime](https://onnxruntime.ai/) (MIT). PDF reading by [pypdfium2](https://github.com/pypdfium2-team/pypdfium2) (Apache-2.0 / BSD-3-Clause, PDFium). Sample receipt made by us with [Noto Sans HK](https://fonts.google.com/noto/specimen/Noto+Sans+HK) (SIL Open Font License).

# Actor input Schema

## `sources` (type: `array`):

One link per line: an image (JPEG, PNG, WebP, BMP, GIF, TIFF) or a PDF, a Google Drive, Dropbox or OneDrive file shared with 'Anyone with the link', or a file you uploaded to an Apify key-value store. The example is a Chinese shop banner.

## `language` (type: `string`):

Leave on the default for Chinese (Simplified and Traditional), Japanese, English and 45+ languages written in Latin letters (Spanish, French, German, Portuguese, Vietnamese, Indonesian, Turkish, ...), also mixed on one page. Pick another option for Korean, Cyrillic, Arabic, Indic, Thai or Greek text.

## `usePdfText` (type: `boolean`):

Pages of a PDF that already contain selectable text are read directly: exact, faster and cheaper (see Pricing). Turn off to recognise every page as an image.

## `maxPagesPerFile` (type: `integer`):

Stop after this many pages of each PDF or multi-page TIFF.

## `minConfidence` (type: `number`):

Lines the model is less sure about than this (0 to 1) are left out. Lower it for faint or handwritten-looking text; raise it to drop more noise.

## `includeLineBoxes` (type: `boolean`):

Add every recognised line with its confidence and its four corner points on the page (pixels). Useful for highlighting or for rebuilding layouts.

## `saveTextFiles` (type: `boolean`):

Also save each document's text as a .txt file and add its link to the results.

## Actor input object example

```json
{
  "sources": [
    "https://api.apify.com/v2/key-value-stores/goyEKYd80hg4wVmA3/records/ocr-sample-receipt.jpg"
  ],
  "language": "auto",
  "usePdfText": true,
  "maxPagesPerFile": 100,
  "minConfidence": 0.6,
  "includeLineBoxes": false,
  "saveTextFiles": true
}
```

# Actor output Schema

## `documents` (type: `string`):

One JSON record per file: full text, text per page, how each page was read, confidence, link to the .txt file, or an error message.

## `textFiles` (type: `string`):

Plain-text files, one per document.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "sources": [
        "https://api.apify.com/v2/key-value-stores/goyEKYd80hg4wVmA3/records/ocr-sample-receipt.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("stfgdev/image-pdf-ocr").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "sources": ["https://api.apify.com/v2/key-value-stores/goyEKYd80hg4wVmA3/records/ocr-sample-receipt.jpg"] }

# Run the Actor and wait for it to finish
run = client.actor("stfgdev/image-pdf-ocr").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "sources": [
    "https://api.apify.com/v2/key-value-stores/goyEKYd80hg4wVmA3/records/ocr-sample-receipt.jpg"
  ]
}' |
apify call stfgdev/image-pdf-ocr --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,stfgdev/image-pdf-ocr"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/8rX2wIBqicylslfGa/builds/grl37mev5uNT4whad/openapi.json
