# Pdf Power Tools (`agenscrape/pdf-power-tools`) Actor

Split, merge, compress, convert & OCR PDFs via API. Extract text from scanned documents in 14 languages. Compress files for email, convert pages to PNG/JPEG/WebP, split by pages or ranges, merge multiple PDFs. Perfect for document automation & data extraction workflows.

- **URL**: https://apify.com/agenscrape/pdf-power-tools.md
- **Developed by:** [Agenscrape](https://apify.com/agenscrape) (community)
- **Categories:** Developer tools, Automation, Integrations
- **Features:** Limited permissions
- **Stats:** 65 total users, 6 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 pdf loadeds

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 Power Tools

Facing an issue, unexpected error, edge case, or have a feature suggestion? [Post it here](https://console.apify.com/actors/VJYPJX5fUDLjtl0uo/issues) and we'll address it within 24 hours.

### What is PDF Power Tools?

PDF Power Tools is a comprehensive PDF processing API that handles all your PDF manipulation needs in the cloud. Whether you need to split large documents, merge multiple PDFs, compress files for email, extract text from scanned documents using OCR, or convert PDF pages to images - this actor does it all.

Perfect for:

- **Document automation workflows** - Process PDFs at scale without local software
- **Data extraction pipelines** - Extract text from scanned invoices, receipts, contracts
- **Content management systems** - Generate thumbnails, compress uploads, split documents
- **Archival and digitization** - OCR historical documents, enhance scanned pages
- **Web applications** - Server-side PDF processing via API

### Features

#### Split PDF

Break down large PDF documents into smaller, manageable files. Split options include:

- **Each page separate** - Create individual PDFs for every page
- **By page ranges** - Split into custom ranges (e.g., pages 1-10, 11-20, 21-30)
- **Split in half** - Divide document into two equal parts
- **Extract specific pages** - Pull out only the pages you need
- **By file size** - Automatically split when file exceeds size limit

#### Merge PDF

Combine multiple PDF files into a single document:

- Merge unlimited PDFs in sequence
- Custom merge order
- Interleave pages from multiple documents
- Insert pages from one PDF into another at specific positions

#### Compress PDF

Reduce PDF file size for email attachments, web uploads, or storage optimization:

- **Low compression** - Minimal size reduction, highest quality
- **Medium compression** - Balanced quality and file size (default)
- **High compression** - Maximum size reduction
- **Screen preset** - Optimized for on-screen viewing
- **Print preset** - Optimized for printing quality

#### Convert PDF to Images

Transform PDF pages into high-quality images:

- Output formats: PNG, JPEG, WebP, TIFF
- Customizable DPI (72-600)
- Convert all pages or specific page selection
- Combine all pages into single tall image
- Generate thumbnails

#### OCR - Text Extraction from Scanned PDFs

Extract text from scanned documents, images, and non-searchable PDFs using Tesseract OCR:

- **14 supported languages**: English, French, German, Spanish, Italian, Portuguese, Dutch, Polish, Russian, Chinese (Simplified & Traditional), Japanese, Korean, Arabic
- Image preprocessing for improved accuracy
- Confidence scores per page
- Word and line count statistics

#### Enhance Scanned PDFs

Improve readability of scanned documents:

- Sharpen blurry text and images
- Reduce noise and artifacts
- Adjust contrast and brightness
- Configurable DPI settings

#### Page Manipulation

Fine-grained control over PDF pages:

- Reorder pages within a document
- Remove unwanted pages
- Insert pages at specific positions

#### PDF Information

Analyze PDF files before processing:

- Page count and dimensions
- File size breakdown
- Detect if PDF is scanned or native text
- Compression estimate

### Input Options

#### Basic Input

```json
{
    "operation": "split",
    "pdfUrl": "https://example.com/document.pdf"
}
```

#### Using Base64 Input

```json
{
    "operation": "compress",
    "pdfBase64": "JVBERi0xLjcKCjEgMCBvYmoK..."
}
```

### Operation Examples

#### Get PDF Information

```json
{
    "operation": "info",
    "pdfUrl": "https://example.com/document.pdf"
}
```

#### Split Into Individual Pages

```json
{
    "operation": "split",
    "pdfUrl": "https://example.com/large-document.pdf",
    "splitMode": "each_page"
}
```

#### Split By Page Ranges

```json
{
    "operation": "split",
    "pdfUrl": "https://example.com/document.pdf",
    "splitMode": "ranges",
    "ranges": ["1-10", "11-20", "21-30"]
}
```

#### Extract Specific Pages

```json
{
    "operation": "split",
    "pdfUrl": "https://example.com/document.pdf",
    "splitMode": "extract",
    "pages": [1, 5, 10, 15]
}
```

#### Merge Multiple PDFs

```json
{
    "operation": "merge",
    "pdfUrls": [
        "https://example.com/part1.pdf",
        "https://example.com/part2.pdf",
        "https://example.com/part3.pdf"
    ]
}
```

#### Merge With Custom Order

```json
{
    "operation": "merge",
    "pdfUrls": ["doc1.pdf", "doc2.pdf", "doc3.pdf"],
    "order": [2, 0, 1]
}
```

#### Compress PDF

```json
{
    "operation": "compress",
    "pdfUrl": "https://example.com/large-file.pdf",
    "compressionPreset": "high"
}
```

#### Convert PDF to PNG Images

```json
{
    "operation": "convert",
    "pdfUrl": "https://example.com/document.pdf",
    "outputFormat": "png",
    "dpi": 200,
    "quality": 95
}
```

#### Convert Specific Pages to JPEG

```json
{
    "operation": "convert",
    "pdfUrl": "https://example.com/document.pdf",
    "outputFormat": "jpeg",
    "pages": [1, 3, 5],
    "dpi": 150
}
```

#### OCR - Extract Text from Scanned PDF

```json
{
    "operation": "ocr",
    "pdfUrl": "https://example.com/scanned-document.pdf",
    "language": "eng",
    "preprocess": true
}
```

#### OCR in French

```json
{
    "operation": "ocr",
    "pdfUrl": "https://example.com/french-scan.pdf",
    "language": "fra"
}
```

#### Enhance Scanned Document

```json
{
    "operation": "enhance",
    "pdfUrl": "https://example.com/old-scan.pdf",
    "sharpen": true,
    "denoise": true,
    "contrast": 1.3,
    "brightness": 1.1
}
```

#### Generate Thumbnail

```json
{
    "operation": "thumbnail",
    "pdfUrl": "https://example.com/document.pdf",
    "thumbnailWidth": 300,
    "outputFormat": "png"
}
```

#### Remove Pages

```json
{
    "operation": "merge",
    "pdfUrl": "https://example.com/document.pdf",
    "pagesToRemove": [2, 5, 8]
}
```

#### Reorder Pages

```json
{
    "operation": "merge",
    "pdfUrl": "https://example.com/document.pdf",
    "newPageOrder": [4, 3, 2, 1, 5, 6]
}
```

### Output

Results are saved to the run's **Key-Value Store** for easy download:

| Operation | Output Files |
|-----------|-------------|
| Split | `page_001.pdf`, `page_002.pdf`, ... or `pages_1-10.pdf`, etc. |
| Merge | `merged.pdf` |
| Compress | `compressed.pdf` |
| Convert | `page_001.png`, `page_002.png`, ... |
| OCR | `extracted_text.txt` + Dataset with per-page results |
| Enhance | `enhanced.pdf` |
| Thumbnail | `thumbnail.png` |

#### Sample Output

```json
{
    "operation": "compress",
    "preset": "high",
    "pageCount": 25,
    "originalSize": "4.5 MB",
    "compressedSize": "1.2 MB",
    "compressionRatio": "73.3%",
    "outputKey": "compressed.pdf"
}
```

### Supported Languages for OCR

| Code | Language |
|------|----------|
| `eng` | English |
| `fra` | French |
| `deu` | German |
| `spa` | Spanish |
| `ita` | Italian |
| `por` | Portuguese |
| `nld` | Dutch |
| `pol` | Polish |
| `rus` | Russian |
| `chi_sim` | Chinese (Simplified) |
| `chi_tra` | Chinese (Traditional) |
| `jpn` | Japanese |
| `kor` | Korean |
| `ara` | Arabic |

### Compression Presets

| Preset | Image Quality | Best For |
|--------|--------------|----------|
| `low` | 90% | Archives, legal documents |
| `medium` | 75% | General use, email |
| `high` | 50% | Web uploads, storage saving |
| `screen` | 60% | On-screen viewing |
| `print` | 85% | Print-quality output |

### Pricing

| Event | Price | Description |
|-------|-------|-------------|
| `pdf-loaded` | $0.005 | Each PDF loaded from URL or base64 |
| `page-enhanced` | $0.01 | Each page enhanced (sharpen, denoise) |
| `page-processed` | $0.002 | Each page processed (split, merge, compress) |
| `ocr-page` | $0.02 | Each page with OCR text extraction |
| `pdf-compressed` | $0.01 | PDF compression completed |
| `page-converted` | $0.005 | Each page converted to image |
| `pdf-merged` | $0.01 | PDF merge operation completed |
| `metadata-extracted` | $0.005 | PDF info/metadata extraction |
| `text-extracted` | $0.005 | Text extraction completed |

### Use Cases

- **Invoice Processing** - Extract data from scanned invoices using OCR
- **Document Splitting** - Break down large reports into chapters
- **PDF Compression** - Reduce file size for email attachments
- **Image Generation** - Create thumbnails for document previews
- **Document Merging** - Combine multiple contracts into one file
- **Archival** - Enhance and OCR historical scanned documents
- **Web Publishing** - Convert PDF pages to web-friendly images
- **Data Extraction** - Pull text from non-searchable PDFs

# Actor input Schema

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

What operation to perform on the PDF(s)

## `pdfUrl` (type: `string`):

URL to a PDF file to process

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

List of PDF URLs to merge together

## `pdfBase64` (type: `string`):

Base64 encoded PDF content (alternative to URL)

## `sharpen` (type: `boolean`):

Apply sharpening to enhance clarity (for enhance operation)

## `denoise` (type: `boolean`):

Apply noise reduction filter (for enhance operation)

## `contrast` (type: `number`):

Contrast adjustment (1.0 = normal, 1.2 = 20% more contrast)

## `brightness` (type: `number`):

Brightness adjustment (1.0 = normal)

## `splitMode` (type: `string`):

How to split the PDF

## `ranges` (type: `array`):

Page ranges to split by (e.g., 1-5, 6-10, 11-15)

## `pages` (type: `array`):

Specific pages to extract or convert (e.g., 1, 3, 5, 7)

## `compressionPreset` (type: `string`):

Compression quality level

## `imageQuality` (type: `integer`):

JPEG quality for images (10-100)

## `targetSizeKB` (type: `integer`):

Try to compress to this file size in KB

## `outputFormat` (type: `string`):

Image format for conversion

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

Output resolution in DPI

## `quality` (type: `integer`):

Output image quality (1-100)

## `singleImage` (type: `boolean`):

Combine all pages into one tall image

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

Language for text recognition

## `preprocess` (type: `boolean`):

Apply image preprocessing for better OCR results

## `order` (type: `array`):

Custom order for merging PDFs (e.g., \[2, 0, 1] to put 3rd PDF first)

## `interleave` (type: `boolean`):

Interleave pages from all PDFs instead of sequential merge

## `pagesToRemove` (type: `array`):

Page numbers to remove from the PDF

## `newPageOrder` (type: `array`):

Reorder pages (e.g., \[3, 1, 2, 4] to put page 3 first)

## `thumbnailWidth` (type: `integer`):

Width of thumbnail in pixels

## Actor input object example

```json
{
  "operation": "info",
  "pdfUrls": [],
  "sharpen": true,
  "denoise": true,
  "contrast": 1.2,
  "brightness": 1,
  "splitMode": "each_page",
  "ranges": [],
  "pages": [],
  "compressionPreset": "medium",
  "outputFormat": "png",
  "dpi": 150,
  "quality": 90,
  "singleImage": false,
  "language": "eng",
  "preprocess": true,
  "interleave": false,
  "pagesToRemove": [],
  "thumbnailWidth": 200
}
```

# 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": [],
    "ranges": [],
    "pages": [],
    "pagesToRemove": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("agenscrape/pdf-power-tools").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": [],
    "ranges": [],
    "pages": [],
    "pagesToRemove": [],
}

# Run the Actor and wait for it to finish
run = client.actor("agenscrape/pdf-power-tools").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": [],
  "ranges": [],
  "pages": [],
  "pagesToRemove": []
}' |
apify call agenscrape/pdf-power-tools --silent --output-dataset

```

## MCP server setup

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

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/VJYPJX5fUDLjtl0uo/builds/q7gWhkfIbeXh2VLMS/openapi.json
