# OCR PDF – Make Scanned PDFs & Images Searchable (Text Layer) (`freecamp008/pdf-ocr-searchable`) Actor

Convert scanned PDFs and images (JPG, PNG, TIFF) into searchable, selectable PDFs with an invisible OCR text layer. 100+ languages, automatic page rotation, per-page confidence. Self-hosted Tesseract, no external APIs.

- **URL**: https://apify.com/freecamp008/pdf-ocr-searchable.md
- **Developed by:** [Camp8 fr0](https://apify.com/freecamp008) (community)
- **Categories:** Developer tools, Automation, AI
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 searchable pdf createds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-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

## OCR PDF – Convert Scanned PDFs & Images to Searchable PDF (100+ Languages)

**OCR PDF** turns scanned PDFs and images (JPG, PNG, multi-page TIFF, WebP) into **searchable, selectable PDFs**. It recognizes the text with Tesseract OCR and adds it as an **invisible text layer positioned exactly over every word**, so the document looks identical but you can search it (Ctrl+F), select and copy text, index it, and feed it to LLMs. You also get the **OCR confidence of every page** and, optionally, the recognized plain text. Everything runs inside the Actor: no external OCR APIs, no per-page fees to third parties, and your documents never leave Apify.

### What does OCR PDF do?

- 🔎 **Searchable PDF output**: original page images are kept untouched; an invisible text layer (render mode 3) is added word by word, aligned to the scanned words.
- 🌍 **100+ languages and all scripts**: Latin, Cyrillic, Greek, Arabic, Hebrew, Devanagari, Chinese, Japanese, Korean... combine languages with `+` (e.g. `eng+deu`). The text layer uses a glyph-less CID font with a Unicode map, so every script copies and searches correctly.
- 🔄 **Fixes page orientation**: pages scanned sideways or upside down are detected, OCR'd in the right orientation and rotated upright in the output.
- 🧠 **Smart skipping**: pages that already contain text (digital pages or previously OCR'd ones) are kept as they are and **never charged**. Mixed PDFs are handled page by page.
- 📊 **Per-page confidence** and word counts, plus the recognized text if you want it.
- ✅ **Verified output**: the finished PDF is re-read with an independent parser and the extractable characters are compared with the OCR result (`verification`).
- 🖼️ **Images in, PDF out**: JPEG (embedded losslessly, no recompression), PNG, multi-page TIFF (one PDF page per TIFF page), WebP, GIF, BMP. EXIF rotation and DPI are respected.
- 🔐 Encrypted PDFs (password), page ranges, and an **HTTP API (Standby mode)** with optional base64 output.

### Use cases

- Make **scanned archives, contracts, invoices and letters** searchable in Acrobat, Preview, Google Drive, SharePoint or Dropbox
- Prepare scans for **RAG / LLM pipelines** and full-text search engines
- **Digitize paper workflows** (mailrooms, accounting, legal, healthcare records)
- Convert **phone photos and fax TIFFs** into proper searchable PDFs
- Pre-process documents for **PDF-to-text, table or invoice extraction** tools that need a text layer

### How to use it

1. Click **Try for free**.
2. Paste one or more **PDF or image URLs**.
3. Set the **OCR language(s)** (default `eng`).
4. Click **Start**. Each file becomes one row with a link to the searchable PDF (`outputUrl`), the mean confidence and per-page details.

#### Call it as an HTTP API (Standby mode)

```bash
## GET with query parameters
curl "https://<your-standby-url>/?fileUrls=https://example.com/scan.pdf&languages=eng" \
  -H "Authorization: Bearer <APIFY_TOKEN>"

## POST with a JSON body, searchable PDF inline as base64
curl -X POST "https://<your-standby-url>/" \
  -H "Authorization: Bearer <APIFY_TOKEN>" -H "Content-Type: application/json" \
  -d '{"fileUrls":["https://example.com/receipt.jpg"],"languages":"eng+fra","returnBase64":true}'
```

Response: `{ "count": 1, "items": [ ... ] }`

You can also use the Apify API (`run-sync-get-dataset-items`), the Apify MCP server, Make, Zapier, n8n and other integrations. **AI agents can pay per call with x402 (USDC)** through Apify's agentic payments, without needing an Apify account.

### Input example

```json
{
  "fileUrls": ["https://raw.githubusercontent.com/ocrmypdf/OCRmyPDF/main/tests/resources/linn.pdf"],
  "languages": "eng",
  "skipPagesWithText": true,
  "autoRotate": true,
  "dpi": 300,
  "includeText": true
}
```

| Field | Description |
|---|---|
| `fileUrls` | Scanned PDFs or images (JPEG, PNG, TIFF, WebP, GIF, BMP); `data:` URLs work too |
| `languages` | Tesseract codes joined with `+`: `eng`, `deu`, `fra`, `spa`, `ita`, `por`, `nld`, `pol`, `rus`, `ukr`, `ara`, `heb`, `hin`, `chi_sim`, `chi_tra`, `jpn`, `kor`... |
| `pages` | PDF page selection like `1-3,7` (others are kept unchanged) |
| `skipPagesWithText` | Don't OCR pages that already have text (default on) |
| `autoRotate` | Detect and fix sideways / upside-down pages (default on) |
| `dpi` | Rasterization resolution for PDF pages (150-400, default 300) |
| `includeText` | Return the recognized text per page (default on) |
| `maxPages` | Page limit per file (default 200) |
| `password` | Password for encrypted PDFs |
| `returnBase64` | Standby API only: include the PDF as base64 |

### Output example

```json
{
  "sourceUrl": "https://raw.githubusercontent.com/ocrmypdf/OCRmyPDF/main/tests/resources/linn.pdf",
  "sourceType": "pdf",
  "outputUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/linn-ae3ba8a62fc9-searchable",
  "key": "linn-ae3ba8a62fc9-searchable",
  "languages": "eng",
  "pageCount": 1,
  "ocrPageCount": 1,
  "skippedPageCount": 0,
  "meanConfidence": 94.6,
  "wordCount": 727,
  "verification": { "extractableChars": 3742, "ocrChars": 3742, "ok": true },
  "outputBytes": 90149,
  "pages": [
    { "page": 1, "ocr": true, "confidence": 94.6, "wordCount": 727, "charCount": 3742, "text": "The LinnSequencer\n32 Track MIDI Sequence Recorder\n..." }
  ],
  "processingMs": 11047
}
```

Pages that were not OCR'd appear as `{ "page": 2, "ocr": false, "reason": "already has text" }`. Rotated pages carry `"rotationFixed": 90` (or 180 / 270).

### Pricing

This Actor uses **pay-per-event** pricing:

| Event | Price |
|---|---|
| OCR page (page recognized and given a text layer) | **$3 per 1,000 pages** ($0.003 each) |
| Searchable PDF created (per input file) | **$1 per 1,000 files** ($0.001 each) |

A 10-page scan costs $0.031. Pages that already contain text, failed downloads and PDFs that are already fully searchable are free. Apify platform usage (compute) is billed separately: OCR is CPU-heavy, expect roughly 5-15 seconds per page at the default 4 GB memory (1 CPU core; OCR is single-threaded, so more memory does not make a single page faster). Set **Maximum cost per run** to cap your spend; if the budget runs out mid-document you still get a PDF with the pages OCR'd so far (`budgetLimited: true`).

### FAQ

**Will my PDF look different?**
No. For PDF input the original pages are kept byte for byte; only an invisible text layer is added (and, if `autoRotate` fixed a page, its display rotation). For image input the image is embedded as is (JPEGs are not recompressed) at its native DPI.

**Which languages are supported?**
All Tesseract languages (100+). English, German, French, Spanish, Italian, Portuguese and Dutch are pre-installed; other languages are downloaded once (a few MB) the first time you use them. Combine languages with `+`, but only use the ones present in the document: each extra language slows OCR down.

**How accurate is it?**
Clean 300 DPI scans of printed text typically reach 90-99% word confidence. Photos, low resolution (< 200 DPI), heavy noise, handwriting and decorative fonts reduce accuracy; check `confidence` per page. Handwriting is not supported.

**My PDF already has text. What happens?**
With `skipPagesWithText` (default) those pages are left untouched and not charged; a fully digital PDF returns a free "already searchable" notice. If an existing text layer is garbage (bad earlier OCR), turn the option off to OCR every page (the old text layer is kept, so search may find both).

**Does it work in Acrobat, Preview, Chrome and Google Drive?**
Yes. The text layer uses the same technique as Tesseract's and OCRmyPDF's PDF renderers (invisible glyph-less font with a ToUnicode map), which all major viewers and text extractors understand. Outputs were verified with pdf.js, pypdf and Apple PDFKit.

**How big can files be?**
Up to 200 MB per file and 2,000 pages (default limit 200). Very large pages are rasterized at a reduced resolution (max ~36 megapixels).

**Is my data private? Is it legal?**
Files are processed inside your Apify run and stored only in your run's key-value store; nothing is sent to third-party services. You are responsible for having the right to process the documents you submit.

**Licenses?**
Tesseract / tesseract.js and tessdata models (Apache-2.0), pdf.js (Apache-2.0), @cantoo/pdf-lib (MIT), sharp / libvips (Apache-2.0 / LGPL-3.0 as a dynamically linked library), @napi-rs/canvas (MIT). All allow commercial use.

# Actor input Schema

## `fileUrls` (type: `array`):

Direct links to scanned PDFs or images (JPEG, PNG, TIFF incl. multi-page, WebP, GIF). <code>data:</code> URLs work too. Each file becomes one searchable PDF.

## `languages` (type: `string`):

Tesseract language code(s), combined with <code>+</code>: <code>eng</code>, <code>deu</code>, <code>fra</code>, <code>spa</code>, <code>ita</code>, <code>por</code>, <code>nld</code>, <code>pol</code>, <code>rus</code>, <code>ukr</code>, <code>ara</code>, <code>hin</code>, <code>chi_sim</code>, <code>jpn</code>, <code>kor</code>... e.g. <code>eng+deu</code>. Use only the languages present in the document (each extra language slows OCR down).

## `pages` (type: `string`):

PDF page selection like <code>1-3,5,10-</code>. Leave empty for all pages. Pages outside the selection are kept unchanged.

## `skipPagesWithText` (type: `boolean`):

Don't OCR pages that already contain a text layer (digital pages or pages OCR'd before). They are kept as they are and never charged. Turn off only for PDFs whose existing text layer is garbage.

## `autoRotate` (type: `boolean`):

Detect pages scanned sideways or upside down, OCR them in the right orientation and rotate them upright in the output.

## `dpi` (type: `integer`):

Resolution at which PDF pages are rasterized for OCR. 300 is the sweet spot; use 400 for tiny print, 200 for speed.

## `includeText` (type: `boolean`):

Also return the recognized plain text of every OCR'd page in the result (handy for search indexes and LLMs).

## `maxPages` (type: `integer`):

Safety limit on pages OCR'd per file.

## `password` (type: `string`):

Password for encrypted PDFs (optional). The output PDF is saved without encryption.

## `returnBase64` (type: `boolean`):

Standby HTTP API only: also include the searchable PDF as a base64 string (<code>pdfBase64</code>) in the response.

## Actor input object example

```json
{
  "fileUrls": [
    "https://raw.githubusercontent.com/ocrmypdf/OCRmyPDF/main/tests/resources/linn.pdf"
  ],
  "languages": "eng",
  "skipPagesWithText": true,
  "autoRotate": true,
  "dpi": 300,
  "includeText": true,
  "maxPages": 200,
  "returnBase64": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `files` (type: `string`):

No description

# 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 = {
    "fileUrls": [
        "https://raw.githubusercontent.com/ocrmypdf/OCRmyPDF/main/tests/resources/linn.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("freecamp008/pdf-ocr-searchable").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 = { "fileUrls": ["https://raw.githubusercontent.com/ocrmypdf/OCRmyPDF/main/tests/resources/linn.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("freecamp008/pdf-ocr-searchable").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 '{
  "fileUrls": [
    "https://raw.githubusercontent.com/ocrmypdf/OCRmyPDF/main/tests/resources/linn.pdf"
  ]
}' |
apify call freecamp008/pdf-ocr-searchable --silent --output-dataset

```

## MCP server setup

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

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/paiyl9TZHwEtJPDlD/builds/1EdW42CZJ0Xiwcjao/openapi.json
