# PDF Toolkit: Merge, Split, Compress & Convert PDFs. (`apifmcpfactory/pdf-toolkit`) Actor

Merge, split, compress, convert, rotate and watermark PDFs in one tool. Batch jobs and URL-to-PDF, no file-size limits. For people and AI agents.

- **URL**: https://apify.com/apifmcpfactory/pdf-toolkit.md
- **Developed by:** [Fred Jones](https://apify.com/apifmcpfactory) (community)
- **Categories:** Developer tools, Agents, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

Merge, split, compress, convert, rotate and watermark PDFs in one tool. Batch jobs and URL-to-PDF, no file-size limits. For people and AI agents.

Paste a PDF or a link, choose what to do, get your file back. No signup, no file-size limits.

### What it does

- **Merge** — combine two or more PDFs into one, in the order given. Input: 2+ PDF URLs → Output: one merged PDF. *Example: merge `report-part1.pdf` and `report-part2.pdf` into `merged.pdf`.*
- **Split** — break one PDF into multiple files, by single pages or page ranges. Input: 1 PDF URL, optional `pages` ranges → Output: one PDF per page or range. *Example: split a 10-page PDF into `split-1.pdf` … `split-10.pdf`.*
- **Compress** — shrink a PDF's file size while keeping every page intact. Input: 1 PDF URL, optional `quality` → Output: one smaller PDF. *Example: compress a 10 MB scan down for email.*
- **Rotate** — turn PDF pages 90/180/270°, all pages or a chosen subset. Input: 1 PDF URL, `angle` → Output: one PDF with rotated pages. *Example: fix a PDF scanned sideways.*
- **Delete pages** — remove specific pages from a PDF and keep the rest. Input: 1 PDF URL, `pages` to remove → Output: one PDF without those pages. *Example: drop the cover page from a contract.*
- **Watermark** — stamp text over every page. Input: 1 PDF URL, `text` (+ opacity/position) → Output: one watermarked PDF. *Example: stamp "CONFIDENTIAL" across a draft.*
- **PDF to images** — render each page of a PDF as an image. Input: 1 PDF URL, `format` (png/jpeg) → Output: one image per page. *Example: turn a slide deck PDF into PNGs for a blog post.*
- **Images to PDF** — combine PNG/JPEG images into one PDF. Input: 1+ image URLs, optional `pageSize` → Output: one combined PDF. *Example: turn 5 scanned photos into one PDF.*
- **URL to PDF** — render any public web page as a downloadable PDF. Input: a page `url` → Output: one PDF snapshot. *Example: save an invoice or article page as a PDF.*

**Coming next:** Office conversions (PDF to Word/Excel) in v2.

### Pricing

Pay per result — a small flat fee for each file produced by a successful operation. Failed runs (bad input, broken URL) produce no result and are never charged.

### How to use PDF Toolkit

1. Open the Actor and pick an **Action** from the dropdown (e.g. "Merge PDFs").
2. Add your file URLs under **Input files** — public https links to the PDFs (or images) you want to process. The default example is pre-filled so you can just hit **Start**.
3. For actions that need extra settings (page ranges, rotation angle, watermark text, a target URL, …), fill in **Options (advanced)** as JSON — see below for the exact keys per action.
4. Click **Start**. When the run finishes, open the **Output** tab to grab the download link(s), or read them from the dataset via the API.

### Input

The input has three fields:

| Field | Type | Description |
|---|---|---|
| `action` | string | One of `merge`, `split`, `compress`, `rotate`, `deletePages`, `watermark`, `pdfToImages`, `imagesToPdf`, `urlToPdf`. |
| `files` | array of strings | Public https URL(s) of the file(s) to process, or `kvs:<key>` to reuse a file already stored in this run's key-value store. Not used by `urlToPdf`. |
| `options` | object | Action-specific settings. See below. |

Options per action:

- `split` / `deletePages` → `{ "pages": "1,3-5" }` (1-based; `split` also accepts `"1-2|3-5"` to produce one file per group).
- `rotate` → `{ "angle": 90 }` (90, 180, or 270; optional `"pages"` to limit which pages rotate).
- `watermark` → `{ "text": "DRAFT", "opacity": 0.3, "position": "center" }` (`position`: `center`, `top-left`, `top-right`, `bottom-left`, `bottom-right`).
- `pdfToImages` → `{ "format": "png", "scale": 2 }` (`format`: `png` or `jpeg`; `scale` ≈ DPI/72).
- `imagesToPdf` → `{ "pageSize": "fit" }` (`fit`, `A4`, or `Letter`).
- `compress` → `{ "quality": "medium" }` (`low`, `medium`, or `high` — lower quality means a smaller file).
- `urlToPdf` → `{ "url": "https://example.com", "format": "A4", "landscape": false }`.

Example — merge two PDFs:

```json
{
    "action": "merge",
    "files": [
        "https://example.com/one.pdf",
        "https://example.com/two.pdf"
    ],
    "options": {}
}
````

### Output

Each run pushes one record to the dataset and saves the resulting file(s) to the key-value store:

```json
{
    "action": "merge",
    "inputCount": 2,
    "outputUrls": ["https://api.apify.com/v2/key-value-stores/.../records/merged.pdf"],
    "sizeBefore": 32074,
    "sizeAfter": 28182,
    "ms": 391
}
```

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel, or just follow the `outputUrls` links directly.

### Tips

- For `pdfToImages`, higher `scale` values produce sharper but larger images — `2` (~144 DPI) is a good default for screen use, `3–4` for print.
- `compress` uses Ghostscript when available for the best size reduction; if it isn't installed it falls back to a structural PDF re-save, which still trims redundant data.
- Chain operations by writing intermediate results with `kvs:<key>` and reading them back in a later run in the same key-value store.

### FAQ

**Is my file stored anywhere?** Only in this run's own key-value store, which follows the Apify platform's standard retention — nothing is kept beyond that.

**Why did my run fail without being charged?** PDF Toolkit validates input before doing any work and only charges after a successful operation — check the error message in the log for what to fix (e.g. an out-of-range page number).

**Found a bug or want a feature?** Open an issue on the Actor's Issues tab.

***

**Tags:** pdf tools, merge pdf, compress pdf, split pdf, convert pdf, pdf to image, url to pdf, watermark pdf, Smallpdf alternative, iLovePDF alternative

# Actor input Schema

## `action` (type: `string`):

What do you want to do?

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

Public https URL(s) of the file(s) to process (PDFs for most actions, images for 'Convert images to a PDF'). Not used for 'Convert a web page to PDF' — use Page URL below instead.

## `options` (type: `object`):

Action-specific settings, as JSON. Only the fields for the selected action are used:
• split / deletePages → "pages": "1,3-5" (1-based page ranges)
• rotate → "angle": 90 | 180 | 270 (clockwise)
• watermark → "text", "opacity" (0-1), "position": "center"|"top-left"|"top-right"|"bottom-left"|"bottom-right"
• pdfToImages → "format": "png"|"jpeg", "scale" (e.g. 2 = ~144 DPI)
• imagesToPdf → "pageSize": "A4"|"Letter"|"fit" (fit = match each image)
• compress → "quality": "low"|"medium"|"high" (low = smallest file)
• urlToPdf → "url": the public https page to render, "format": "A4"|"Letter", "landscape": true|false

## Actor input object example

```json
{
  "action": "merge",
  "files": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://pdfobject.com/pdf/sample.pdf"
  ],
  "options": {}
}
```

# Actor output Schema

## `results` (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 = {
    "files": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://pdfobject.com/pdf/sample.pdf"
    ],
    "options": {}
};

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

# Run the Actor and wait for it to finish
run = client.actor("apifmcpfactory/pdf-toolkit").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://pdfobject.com/pdf/sample.pdf"
  ],
  "options": {}
}' |
apify call apifmcpfactory/pdf-toolkit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=apifmcpfactory/pdf-toolkit",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "PDF Toolkit: Merge, Split, Compress & Convert PDFs.",
        "description": "Merge, split, compress, convert, rotate and watermark PDFs in one tool. Batch jobs and URL-to-PDF, no file-size limits. For people and AI agents.",
        "version": "0.0",
        "x-build-id": "u3fBFRJ3QImi04NPk"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/apifmcpfactory~pdf-toolkit/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-apifmcpfactory-pdf-toolkit",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/apifmcpfactory~pdf-toolkit/runs": {
            "post": {
                "operationId": "runs-sync-apifmcpfactory-pdf-toolkit",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/apifmcpfactory~pdf-toolkit/run-sync": {
            "post": {
                "operationId": "run-sync-apifmcpfactory-pdf-toolkit",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "action"
                ],
                "properties": {
                    "action": {
                        "title": "Action",
                        "enum": [
                            "merge",
                            "split",
                            "compress",
                            "rotate",
                            "deletePages",
                            "watermark",
                            "pdfToImages",
                            "imagesToPdf",
                            "urlToPdf"
                        ],
                        "type": "string",
                        "description": "What do you want to do?",
                        "default": "merge"
                    },
                    "files": {
                        "title": "Input files",
                        "type": "array",
                        "description": "Public https URL(s) of the file(s) to process (PDFs for most actions, images for 'Convert images to a PDF'). Not used for 'Convert a web page to PDF' — use Page URL below instead.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "options": {
                        "title": "Options (advanced)",
                        "type": "object",
                        "description": "Action-specific settings, as JSON. Only the fields for the selected action are used:\n• split / deletePages → \"pages\": \"1,3-5\" (1-based page ranges)\n• rotate → \"angle\": 90 | 180 | 270 (clockwise)\n• watermark → \"text\", \"opacity\" (0-1), \"position\": \"center\"|\"top-left\"|\"top-right\"|\"bottom-left\"|\"bottom-right\"\n• pdfToImages → \"format\": \"png\"|\"jpeg\", \"scale\" (e.g. 2 = ~144 DPI)\n• imagesToPdf → \"pageSize\": \"A4\"|\"Letter\"|\"fit\" (fit = match each image)\n• compress → \"quality\": \"low\"|\"medium\"|\"high\" (low = smallest file)\n• urlToPdf → \"url\": the public https page to render, \"format\": \"A4\"|\"Letter\", \"landscape\": true|false",
                        "default": {}
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
