# PDF Tools: Merge, Split, Extract Pages & Info (`klyve1/pdf-merge-split-tools`) Actor

Merge several PDFs into one, split a PDF into single pages or ranges, extract chosen pages, and read page count and metadata. Works from PDF URLs, results saved as downloadable files.

- **URL**: https://apify.com/klyve1/pdf-merge-split-tools.md
- **Developed by:** [Nico Klyve](https://apify.com/klyve1) (community)
- **Categories:** Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 pdf processeds

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 Tools: Merge, Split, Extract Pages & Info

A simple PDF toolbox in the cloud: **merge** several PDFs into one file, **split** a PDF into single pages or parts of N pages, **extract** chosen pages, or read the **page count and metadata** of many PDFs at once. Give PDF links, get downloadable PDF files back. No upload to a free website full of ads, no software to install, and it runs from the API or on a schedule.

### Who uses it

- **Back offices**: merge invoices, delivery notes and contracts into one file per customer.
- **Legal and admin**: extract the signed pages or one annex from a long document.
- **Automation builders (Make, Zapier, n8n)**: add a PDF merge or split step to a workflow.
- **Data teams**: count pages and read metadata of a large list of PDFs before processing them.

### Example output

Merge of two files, pages 1 to 3 of each:

```json
{
  "operation": "merge",
  "fileKey": "merged.pdf",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/<store-id>/records/merged.pdf",
  "fileSizeBytes": 166867,
  "pageCount": 4,
  "sources": [
    { "url": "https://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/tracemonkey.pdf", "ok": true, "pagesTaken": 3 },
    { "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", "ok": true, "pagesTaken": 1 }
  ],
  "error": null
}
```

Split gives one row per output file (`part`, `pages`, `fileUrl`). Info gives `pageCount`, `pageSizes`, `title`, `author`, `creator`, `producer`, `creationDate`, `modificationDate`.

### Input

| Field | What it does | Default |
|---|---|---|
| `operation` | `merge`, `split`, `extract` or `info` | merge |
| `pdfUrls` | Direct links to PDF files (up to 100 MB each). For merge, the order is kept | required |
| `pages` | Page selection such as `1-3,5,8-last`. Empty = all pages | |
| `splitEvery` | Pages per output file when splitting | 1 |
| `outputName` | Name of the merged file | merged |

### Pricing

Pay per result: **$0.002 per input PDF processed**, whatever the number of pages or output files. PDFs that cannot be downloaded or read are free.

### Good to know

- Output files are stored in the run's key-value store: open `fileUrl` to download them (they follow your Apify data retention).
- Pages are copied as they are: text, images, fonts and links stay intact. Password-protected PDFs may not be readable.
- Only process documents you have the right to use.

# Actor input Schema

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

merge = join all PDFs into one file, in the given order. split = cut each PDF into parts of N pages. extract = keep only the chosen pages of each PDF. info = page count, page sizes and metadata (no file produced).

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

Direct links to the PDF files, one per line (up to 100 MB each). For merge, the order of this list is the order of the pages.

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

Optional page selection applied to every PDF, for example 1-3,5,8-last. Empty means all pages. Used by merge, split and extract.

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

With split, each output file gets this many pages. 1 gives one file per page.

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

Name of the merged PDF file, without extension.

## Actor input object example

```json
{
  "operation": "merge",
  "pdfUrls": [
    "https://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/tracemonkey.pdf",
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "pages": "1-3",
  "splitEvery": 1,
  "outputName": "merged"
}
```

# Actor output Schema

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

All rows produced by the run.

# 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 = {
    "operation": "merge",
    "pdfUrls": [
        "https://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/tracemonkey.pdf",
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ],
    "pages": "1-3"
};

// Run the Actor and wait for it to finish
const run = await client.actor("klyve1/pdf-merge-split-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 = {
    "operation": "merge",
    "pdfUrls": [
        "https://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/tracemonkey.pdf",
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    ],
    "pages": "1-3",
}

# Run the Actor and wait for it to finish
run = client.actor("klyve1/pdf-merge-split-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 '{
  "operation": "merge",
  "pdfUrls": [
    "https://raw.githubusercontent.com/mozilla/pdf.js/master/test/pdfs/tracemonkey.pdf",
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "pages": "1-3"
}' |
apify call klyve1/pdf-merge-split-tools --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,klyve1/pdf-merge-split-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/eynqccJEj0KGs3ug3/builds/D8m8osGH99erjmx6B/openapi.json
