# PDF Merge, Split, Extract & Rotate Pages (Bulk) (`toowl/pdf-toolkit`) Actor

Merge PDFs into one, split PDFs by page or range, extract or delete pages, rotate pages and unlock password-protected PDFs, in bulk from URLs. Text, links and quality untouched (qpdf). Pay per PDF.

- **URL**: https://apify.com/toowl/pdf-toolkit.md
- **Developed by:** [Chalid Ade](https://apify.com/toowl) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 pdfs processed

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

## PDF Merge, Split, Extract & Rotate Pages (Bulk)

One Actor for everyday PDF page work, in bulk from URLs:

- **Merge** many PDFs into one, in the order you list them.
- **Split** each PDF into single pages, into files of N pages, or by custom ranges (`1-2, 3-10, 11-`).
- **Extract** the pages you want, in the order you want (`3,1,5-7`).
- **Delete** pages.
- **Rotate** all or some pages by 90°, 180° or 270°.
- **Unlock**: remove the password and the print/copy restrictions (you give the password that opens it).

Built on **qpdf**, which rewrites the PDF structure without re-rendering anything: text stays selectable, links and bookmarks inside the kept pages keep working, quality is untouched, and files usually come out a little smaller.

### Use cases

- Join a cover letter, CV and certificates into one application PDF.
- Split a scanned batch into one PDF per page, or a 500-page export into chapters.
- Drop blank or confidential pages before sharing.
- Fix sideways scans.
- Automate all of it from Make, Zapier, n8n or your own code.

### Input

```json
{
  "operation": "merge",
  "files": [
    { "url": "https://example.com/cover.pdf" },
    { "url": "https://example.com/report.pdf" }
  ],
  "outputName": "application"
}
```

| Field | Default | Used by | Notes |
| --- | --- | --- | --- |
| `operation` | `merge` | | `merge`, `split`, `extract`, `delete`, `rotate`, `unlock` |
| `files` | — | all | PDF URLs |
| `pages` | — | extract, delete, rotate | `1-3,7`, `10-`, `last` |
| `splitEvery` | 1 | split | pages per file |
| `splitRanges` | — | split | `1-2, 3-10, 11-` |
| `rotation` | `90` | rotate | `90`, `180`, `270` (clockwise) |
| `outputName` | `merged` | merge | |
| `password` | — | all | Secret, for protected PDFs |
| `maxFileSizeMb` | 100 | all | |

### Output

Merge gives one row; the other operations give one row per input PDF.

```json
{
  "url": "https://example.com/book.pdf",
  "name": "book.pdf",
  "operation": "split",
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/…/records/0001-book-split.zip",
  "parts": 3,
  "files": [
    { "name": "book-1-2.pdf", "pages": "1-2", "downloadUrl": "https://api.apify.com/v2/key-value-stores/…/records/0001-book-1-2.pdf", "size": 48211 }
  ]
}
```

### Pricing

Pay per event: one `pdf-processed` per input PDF (merging 5 files = 5 events). Failed files are free.

### Free browser version

[merge-pdf](https://toowl.my.id/en/merge-pdf/), [split-pdf](https://toowl.my.id/en/split-pdf/), [organize-pdf](https://toowl.my.id/en/organize-pdf/) and [unlock-pdf](https://toowl.my.id/en/unlock-pdf/) on toowl.my.id do the same in your browser, free, nothing uploaded.

### Call it from your code

```bash
curl -X POST "https://api.apify.com/v2/acts/toowl~pdf-toolkit/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"operation":"merge","files":[{"url":"https://example.com/a.pdf"},{"url":"https://example.com/b.pdf"}]}'
```

The same call works from Python (`apify-client`), JavaScript, Make, Zapier and n8n (Apify app/node or a plain HTTP request).

### Use it from AI agents (MCP)

Add this Actor as a tool to Claude, Cursor, VS Code or any MCP client through Apify's MCP server:

```
https://mcp.apify.com/?actors=toowl/pdf-toolkit
```

The agent can then pass file URLs and read the results itself.

### More toowl file APIs

Speech to text & subtitles, AI vocal remover, text to speech, AI object remover, PDF to Markdown, PDF to Word & Excel, HTML/URL to PDF, OCR, Office to PDF, PDF compressor, PDF merge/split, PDF password protect, PDF to image, image to PDF, bulk watermark, image converter and compressor, background remover, AI upscaler, image to SVG, QR code and barcode generators, QR/barcode reader, favicon generator, video compressor, frame extractor and audio converter. All pay per file, all batch-friendly: [toowl.my.id/en/api](https://toowl.my.id/en/api/).

Questions or a format that fails? Open an issue on the Actor's **Issues** tab.

# Actor input Schema

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

Merge joins all files into one PDF, in the order listed. Every other operation works on each file separately.

## `files` (type: `array`):

Direct links to the PDF files. For merging, the order here is the page order.

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

For extract and delete (required) and rotate (empty = all pages): pages and ranges like "1-3,7", "10-" (10 to the end) or "last". Extract keeps the order you write.

## `splitEvery` (type: `integer`):

1 makes one PDF per page, 10 makes files of 10 pages.

## `splitRanges` (type: `string`):

Instead of a fixed size: one output file per comma-separated range, e.g. "1-2, 3-10, 11-". Overrides pages per file.

## `rotation` (type: `string`):

Clockwise.

## `outputName` (type: `string`):

Name of the merged PDF.

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

For password-protected PDFs (the password that opens them). Used for every file in this run.

## `maxFileSizeMb` (type: `integer`):

Larger files are skipped with an error (not charged).

## Actor input object example

```json
{
  "operation": "merge",
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/report.pdf"
    },
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/sample.pdf"
    }
  ],
  "splitEvery": 1,
  "rotation": "90",
  "outputName": "merged",
  "maxFileSizeMb": 100
}
```

# Actor output Schema

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

One row per input file, with a download link for the result where there is one.

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

Result files in the default key-value store, plus a SUMMARY record.

# 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 = {
    "files": [
        {
            "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/report.pdf"
        },
        {
            "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/sample.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("toowl/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 = { "files": [
        { "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/report.pdf" },
        { "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/sample.pdf" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("toowl/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 '{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/report.pdf"
    },
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/sample.pdf"
    }
  ]
}' |
apify call toowl/pdf-toolkit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,toowl/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/Xhs62Pvhfb2bQR4IA/builds/5Ll0YiQ3OvfoacPSW/openapi.json
