# PDF Toolkit — OCR, Split, Merge (`powerfully_goliath/pdf-toolkit`) Actor

OCR a scanned PDF into a searchable one, extract a page range, or merge several PDFs. Pay per page OCR'd or per job, with no subscription.

- **URL**: https://apify.com/powerfully\_goliath/pdf-toolkit.md
- **Developed by:** [Richie Ellis](https://apify.com/powerfully_goliath) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 page made searchables

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/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

## PDF Toolkit — OCR, Split, Merge

Three PDF jobs that should never need a subscription: **make a scan searchable**,
**pull out a page range**, and **join files into one**. Pay for the pages you
actually OCR, or the job you actually run. No monthly fee, no account on a
third-party site, no uploading a contract to a free web tool that keeps a copy.

***

### What it does

| Operation | What you get back |
|---|---|
| **OCR** | Your PDF, unchanged to look at, with a searchable, selectable, copy-pasteable text layer underneath. Pages that already have text are left alone. |
| **Split** | A new PDF containing only the pages you asked for — `1-3`, `1,3,5`, or any mix. |
| **Merge** | One PDF, files joined in the order you list them. |

Output files land in the run's key-value store, ready to download or pass
straight into the next step of a workflow.

### Input

- **Operation** — `ocr`, `split` or `merge`.
- **PDF file** — upload one file, or
- **PDF URLs** — direct `http(s)` links, up to 20 files, 64 MiB each. Merge
  joins them in the order given.
- **Page range** — split only: `1-3` or `1,3,5`.

```json
{
  "operation": "ocr",
  "pdfUrls": ["https://example.com/scanned-contract.pdf"]
}
```

```json
{
  "operation": "split",
  "pdfUrls": ["https://example.com/report.pdf"],
  "pages": "4-6"
}
```

```json
{
  "operation": "merge",
  "pdfUrls": [
    "https://example.com/invoice-jan.pdf",
    "https://example.com/invoice-feb.pdf"
  ]
}
```

### Output

One dataset item per result, and the file itself in the key-value store:

```json
{
  "operation": "ocr",
  "sourceUrl": "https://example.com/scanned-contract.pdf",
  "pages": 12,
  "message": "OCR complete (12 pages).",
  "outputs": [{ "key": "ocr-scanned-contract-00-ocr.pdf", "filename": "ocr.pdf", "bytes": 412887 }]
}
```

An `OUTPUT` record summarises the run, including anything that was rejected and
why.

### Pricing

| Event | Price |
|---|---|
| Page made searchable (OCR) | $0.006 per page |
| Page range extracted (split) | $0.015 per job |
| PDFs merged | $0.015 per job |

A 10-page scanned contract costs **$0.06**. Pulling three pages out of a
200-page report costs **$0.015**. You are charged only when the work succeeds —
a file we reject costs you nothing beyond the run start.

### Limits and guarantees

- **64 MiB (67 MB)** per file, **20 files** per run, **300 pages** overall,
  **100 pages** for OCR (OCR is the expensive one, so it gets the tighter cap).
- **Nothing is kept.** Each run gets its own isolated working directory, and
  working files are swept after two hours. Your output lives in *your* run's
  storage, under your account.
- **Bad input is rejected, not crashed on.** A file that is not really a PDF, a
  corrupt one, an oversized one, or a page range that is not a page range all
  come back as a plain message saying what was wrong.

### Common uses

- Make a folder of scanned invoices or receipts searchable before filing them.
- Split a long statement or report into the section someone actually asked for.
- Merge a set of generated pages into one document at the end of a pipeline.
- Put a text layer on scans so a downstream extraction step has something to read.

### Under the hood

`ocrmypdf` / `tesseract` for OCR, `qpdf` for split and merge, `poppler` for
inspection — the mature open-source tools, wrapped so you do not have to install
or babysit them. The processing core has been in production use since 7 Sep 2026
and was hardened against a written break-it checklist: non-PDF uploads, corrupt
files, oversized files, path-traversal filenames and shell-metacharacter page
ranges. `subprocess` is always called with an argument list, never `shell=True`.

### Not supported yet

Password-protected PDFs, per-page image export, form filling, and languages
other than English for OCR. Ask if you need one — they are small additions.

# Actor input Schema

## `operation` (type: `string`):

What to do with the PDF(s). OCR makes a scan searchable, split extracts a page range, merge joins two or more files in the order given.

## `pdfFile` (type: `string`):

Upload a single PDF. For merge, or to process several files, use the PDF URLs field below instead.

## `pdfUrls` (type: `array`):

Direct http(s) links to PDFs. Merge joins them in this order. Maximum 20 files, 64 MiB each.

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

Which pages to keep, for example 1-3 or 1,3,5. Required for split, ignored otherwise.

## Actor input object example

```json
{
  "operation": "ocr",
  "pdfUrls": [
    "https://example.com/scanned-contract.pdf"
  ],
  "pages": "1-3"
}
```

# Actor output Schema

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

One item per result: operation, source URL(s), pages, message and the key-value store keys of the files written.

## `ocrFiles` (type: `string`):

OCR output files.

## `splitFiles` (type: `string`):

Split output files.

## `mergeFiles` (type: `string`):

Merge output files.

## `runSummary` (type: `string`):

The OUTPUT record: operation, number of results, rejected inputs with reasons, and events charged.

# 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 = {
    "pdfUrls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("powerfully_goliath/pdf-toolkit").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 = { "pdfUrls": ["https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("powerfully_goliath/pdf-toolkit").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 '{
  "pdfUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ]
}' |
apify call powerfully_goliath/pdf-toolkit --silent --output-dataset

```

## MCP server setup

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

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/FverBZW7ed3gzBzkx/builds/nKcFD6sJMNxeWXOem/openapi.json
