# Split PDF API: Split by Ranges or Extract Pages (`ferrolark/pdf-split-api`) Actor

Split PDF API: split a PDF from a URL or base64 into separate files by page ranges, every N pages, or extract selected pages into one file. ZIP bundle and SHA-256 manifest. For n8n, Make and AI agents. $0.002 per output file.

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

## Pricing

$2.00 / 1,000 pdf file createds

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 Split API: Split by Ranges, Every Page or Extract Pages

Send one PDF as a URL or base64 and get separate PDF files back. There are three modes:

- **every**: one file per page, or chunks of N pages
- **ranges**: one file per range you list, for example `1-3`, `4-10`, `11-`, `last`
- **extract**: the pages you pick, in your order, as a single PDF

Each output file is listed with its pages, bytes, SHA-256 and a download link, and all files also come in one ZIP. It is a plain API call, so you don't need to install anything, add community nodes or sign up for a PDF service. Works with n8n, Make, Zapier, scripts and AI agents.

### Real example

This input:

```json
{"pdfUrl": "https://arxiv.org/pdf/1706.03762", "mode": "ranges", "ranges": ["1", "2-5", "13-15"]}
```

split the 15-page, 2.2 MB paper into 3 files plus a ZIP.

- Run time: 4.0 s on Apify at 512 MB.
- Platform usage: $0.0006.
- Your cost: 3 files × $0.002 = **$0.006**.

| File | Pages | Bytes |
|---|---|---:|
| `1706.03762-part-001.pdf` | 1 | 95,776 |
| `1706.03762-part-002.pdf` | 2-5 | 417,966 |
| `1706.03762-part-003.pdf` | 13-15 | 1,638,676 |

One dataset row per file:

```json
{
  "fileName": "1706.03762-part-002.pdf",
  "mimeType": "application/pdf",
  "bytes": 417966,
  "sha256": "754ff41fc5eb9e2c32b693b5843e0a053f112df71427c88055fbc9c365ca4cdc",
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/<store-id>/records/1706.03762-part-002.pdf",
  "part": 2,
  "pages": [2, 3, 4, 5],
  "pageCount": 4,
  "source": "1706.03762"
}
```

The `OUTPUT` record holds the input's size, SHA-256 and page count, the ZIP's download link, and any warnings.

### Price and limits

- **$0.002 per output PDF.** The ZIP bundle is free.
- Invalid input is not charged: a broken URL, a file that is not a PDF, a wrong password or a page out of range fails the run with "Not charged: …".
- Before writing anything, the Actor checks that all files fit within your max total charge. If they don't, it stops without charging.
- Limits:
  - one input PDF per run;
  - 30 MB and 2,000 pages per input;
  - 500 output files per run.

### Input

| Field | What it does |
|---|---|
| `pdfUrl` | Public URL of the PDF. |
| `pdfBase64` + `fileName` | The PDF itself, for example an n8n binary. Keep the whole input under about 9 MB. |
| `mode` | `every` (default), `ranges` or `extract`. |
| `everyNPages` | Pages per file in `every` mode. 1 gives one file per page. |
| `ranges` | One file per entry. Pages are 1-based; `11-` means to the end, `last` is the last page, and `5-1` is reversed. Ranges may overlap. |
| `pages` | Pages to extract in `extract` mode, for example `1,3,5-7,last`. |
| `password` | Secret field, for encrypted PDFs. Outputs are not encrypted. |
| `createZip` | Bundle all outputs in a ZIP (default on). |
| `createShareableUrl` | Also return signed links that work without a token (default off). |

### Output and privacy

- Files are saved in the run's own key-value store.
- `downloadUrl` needs your Apify token. Turn on `createShareableUrl` only if you must hand a link to someone else.
- No text extraction or OCR is done, and file contents are not logged.
- Automatic page actions (`/AA`) and document-level JavaScript are not copied.
- Digitally signed inputs can be split, but the signature is not valid in the new files, and you get a warning.

### Call it from code, n8n or an AI agent

**API (synchronous):**

```bash
curl -X POST "https://api.apify.com/v2/acts/ferrolark~pdf-split-api/run-sync-get-dataset-items?maxTotalChargeUsd=0.1" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"pdfUrl": "https://example.com/invoices.pdf", "mode": "every"}'
```

**n8n:** paste this workflow on the canvas (Ctrl+V). Then add a Header Auth credential with the name `Authorization` and the value `Bearer <your Apify token>`, and use it in both HTTP nodes.

- The second node downloads every split file as an n8n binary.
- To split a binary that is already in n8n, send it as `pdfBase64`.

```json
{
  "name": "Ferrolark pdf-split-api",
  "nodes": [
    {
      "parameters": {},
      "name": "When clicking Test workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/ferrolark~pdf-split-api/run-sync-get-dataset-items?maxTotalChargeUsd=0.05",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\"pdfUrl\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\", \"mode\": \"every\", \"everyNPages\": 1}",
        "options": {
          "timeout": 300000
        }
      },
      "name": "Run Actor",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "url": "={{ $json.downloadUrl }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "name": "Download file",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        0
      ]
    }
  ],
  "connections": {
    "When clicking Test workflow": {
      "main": [
        [
          {
            "node": "Run Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Actor": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
```

**Make / Zapier:** use the Apify app's "Run Actor" action with `ferrolark/pdf-split-api`, then download each `downloadUrl` with the same `Authorization` header.

**AI agents (MCP):** add `ferrolark/pdf-split-api` to the Apify MCP server (`https://mcp.apify.com?actors=ferrolark/pdf-split-api`).

### Use cases

- Split a scanned batch of invoices or delivery notes into one PDF per page for your accounting tool.
- Send only the signature page, or the first two pages, of a long contract.
- Break a large report into chapters before uploading it to a RAG index with size limits.

### Troubleshooting

- **"not a PDF file"**: the URL returns an HTML page (a login or viewer page). Use a direct download link.
- **"Page N is out of range"**: the file has fewer pages. Check `pagesInFile` in `OUTPUT`.
- **"would cost more than the max total charge allows"**: raise the run's max total charge, or use larger chunks.
- **Output files are larger than expected**: pages that share fonts or images each carry their own copy. That is normal for split PDFs.

### Limitations

- No OCR, compression or conversion.
- It does not remove passwords you don't have.
- Bookmarks and form-level settings of the original document are not kept in the parts.

### Changelog

- **1.0** (November 2026): first release. `every`, `ranges` and `extract` modes; URL or base64 input; ZIP; SHA-256 manifest; encrypted input; signature warning.

### More Ferrolark tools

- [Brand Name Availability Checker](https://apify.com/ferrolark/brand-name-checker): domains, GitHub, npm, PyPI and more in one report.
- [Domain Intelligence Report](https://apify.com/ferrolark/domain-intelligence-report): WHOIS, DNS, email security, SSL and hosting for any domain.
- [Launch Asset Pack](https://apify.com/ferrolark/launch-asset-pack): favicons, PWA icons, OG image and head tags from one logo.
- [Live Deploy QA](https://apify.com/ferrolark/live-deploy-qa): meta tags, canonical, robots, OG image and favicon of your deployed routes, with diffs between deploys.
- [Sitemap Delta](https://apify.com/ferrolark/sitemap-delta): new, removed and broken URLs in any sitemap since the last run.
- [RSS Delta](https://apify.com/ferrolark/rss-delta): only new RSS, Atom and JSON Feed items, de-duplicated.
- [PDF Merge API](https://apify.com/ferrolark/pdf-merge-api): merge PDFs from URLs or base64 with page ranges and a SHA-256 manifest.
- [Image Convert](https://apify.com/ferrolark/image-convert): PNG, JPG, WebP, AVIF and HEIC conversion (SVG input too) from URLs or base64.
- [Image Compress & Resize](https://apify.com/ferrolark/image-compress-resize): resize images and compress them to a target size in KB, WebP or AVIF.
- [PDF to Image](https://apify.com/ferrolark/pdf-to-image): PDF pages to PNG, JPG or WebP at the DPI you choose.
- [Image to PDF](https://apify.com/ferrolark/image-to-pdf): JPG, PNG, HEIC and WebP images to one PDF, JPEGs embedded without recompression.
- [PDF Compress](https://apify.com/ferrolark/pdf-compress): smaller PDFs, lossless or with image downsampling; charged only when smaller.
- [HTML to PDF & URL to PDF](https://apify.com/ferrolark/html-to-pdf): web pages or raw HTML to PDF with headless Chrome.
- [Markdown to PDF](https://apify.com/ferrolark/markdown-to-pdf): Markdown with tables, code and footnotes to a clean PDF.
- [DOCX to PDF](https://apify.com/ferrolark/docx-to-pdf): Word, Excel, PowerPoint and ODT to PDF with LibreOffice.
- [Data Convert](https://apify.com/ferrolark/data-convert): CSV, JSON, NDJSON and Excel XLSX in any direction.

***

*Built by Ferrolark.*

# Actor input Schema

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

Public URL of the PDF (up to 30 MB, 2,000 pages). Use this or PDF as base64.

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

The PDF itself as base64 or a data: URL, for example an n8n or Make binary. Keep the whole input under about 9 MB; use a URL for bigger files.

## `fileName` (type: `string`):

Used to name the output files, for example invoice.pdf -> invoice-part-001.pdf.

## `mode` (type: `string`):

How to split.

## `everyNPages` (type: `integer`):

1 creates one file per page; 10 creates files of 10 pages.

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

One output file per entry, for example 1-3, 4-10, 11-, last. Pages are 1-based; ranges can overlap or be reversed (5-1).

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

For example 1,3,5-7,last. Pages are written in the order given.

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

Needed only for password-protected PDFs. Output files are not encrypted.

## `createZip` (type: `boolean`):

Bundle all output files in one ZIP (free).

## `createShareableUrl` (type: `boolean`):

Also return signed links that work without an Apify token. Anyone with a link can download that file.

## Actor input object example

```json
{
  "pdfUrl": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "mode": "every",
  "everyNPages": 1,
  "createZip": true,
  "createShareableUrl": false
}
```

# Actor output Schema

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

No description

## `files` (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 = {
    "pdfUrl": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ferrolark/pdf-split-api").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 = { "pdfUrl": "https://www.irs.gov/pub/irs-pdf/fw9.pdf" }

# Run the Actor and wait for it to finish
run = client.actor("ferrolark/pdf-split-api").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 '{
  "pdfUrl": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
}' |
apify call ferrolark/pdf-split-api --silent --output-dataset

```

## MCP server setup

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

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/9XpPePNh41oDyfRiv/builds/x9KMOMvhihLkL3hcR/openapi.json
