# Pdf Page Splitter (`vivianferreira/pdf-page-splitter`) Actor

Split any PDF into individual pages instantly. Extract all pages, specific pages (1,3,5), or ranges (1-5). Handles up to 50,000 pages. Flat $0.005 per run. Perfect first step for document processing pipelines — chain with OCR, table extraction, and text analysis actors.

- **URL**: https://apify.com/vivianferreira/pdf-page-splitter.md
- **Developed by:** [Vivian Ferreira](https://apify.com/vivianferreira) (community)
- **Categories:** Integrations, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$0.005 / actor start

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.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.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/platform/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

## ✂️ PDF Page Splitter

> Split any PDF into individual pages — then chain into 100+ Apify actors for extraction, OCR, or analysis.

### What does PDF Page Splitter do?

PDF Page Splitter takes a multi-page PDF and splits it into individual single-page PDFs. You can extract **all pages**, pick **specific pages** (e.g., `1,3,5`), or select a **range** (e.g., `1-5`).

This is the essential first step in any document processing pipeline.

#### Key features

- ✅ **Flexible page selection** — `all`, `1`, `1,3,5`, `1-5`, `1,3-5,7`
- ✅ **Two output modes** — Dataset (base64 JSON for chaining) or Key-Value Store (binary files for download)
- ✅ **Upload or URL** — Upload a PDF directly or provide a URL
- ✅ **Memory efficient** — Processes pages one-by-one with periodic cleanup
- ✅ **Lightweight** — Runs on just 256 MB of memory
- ✅ **Handles massive PDFs** — Up to 50,000 pages / 500 MB
- ✅ **Flat pricing** — One flat fee per run, no matter how many pages

---

### Use cases

| Use Case | Pages Setting | Output Format |
|----------|---------------|---------------|
| Split batched invoices for processing | `all` | Dataset (base64) |
| Extract a specific contract page for review | `3` | Key-Value Store |
| Pull first 5 pages from a report | `1-5` | Dataset (base64) |
| Cherry-pick pages from a large document | `1,5,10-15,20` | Key-Value Store |

#### Who is this for?

- **n8n / Make.com automation builders** who process documents in workflows
- **Finance teams** splitting batched invoices and payment advices
- **Legal teams** extracting specific pages from large contracts
- **AI/RAG pipeline developers** who need individual pages for processing

---

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `pdfFile` | File Upload | — | Upload a PDF file directly |
| `pdfUrl` | String | — | URL to a PDF file (for chaining from other actors) |
| `pages` | String | `all` | Page selection: `all`, `1`, `1,3,5`, `1-5`, `1,3-5,7` |
| `outputFormat` | Enum | `dataset_base64` | `dataset_base64` (JSON with base64) or `key_value_store` (binary files) |

> **Note:** Provide either `pdfFile` or `pdfUrl`. If both are provided, `pdfFile` takes priority.

#### Page selection examples

````

all          → Extract every page
1            → Just the first page
1,3,5        → Pages 1, 3, and 5
1-5          → Pages 1 through 5
1,3-5,7      → Pages 1, 3, 4, 5, and 7

````

---

### Output

#### Dataset output (`dataset_base64`)

Each page becomes one row in the dataset:

```json
{
    "page_number": 1,
    "filename": "page_1_invoice.pdf",
    "size_bytes": 12345,
    "content_base64": "JVBERi0xLjQK...",
    "original_filename": "invoice.pdf",
    "total_pages": 10
}
````

#### Key-Value Store output (`key_value_store`)

Each page is saved as a binary PDF file in the default Key-Value Store:

- `page_1_invoice.pdf`
- `page_2_invoice.pdf`
- `page_3_invoice.pdf`
- etc.

***

### Pricing

This Actor uses **flat per-run** pricing:

| Event | Price |
|-------|-------|
| `run-completed` (per run, any number of pages) | **$0.005** |

**Example costs:**

- Split a 10-page PDF → **$0.005**
- Extract 3 specific pages → **$0.005**
- Split a 10,000-page document → **$0.005**

Same price whether you split 1 page or 10,000. Platform compute costs vary by memory and run time.

***

### Chaining with other actors

PDF Page Splitter is designed as the **gateway** to document processing pipelines:

```
                    ┌─→ Resume Text Extractor
                    │
PDF Page Splitter ──┼─→ Indian Payment Advice Parser
                    │
                    ├─→ Document Table Extractor
                    │
                    └─→ PDF to PNG Converter
```

#### Input sources

- Any file download actor
- Gmail attachment scraper
- Website crawler (PDF links)
- Manual upload

#### Output destinations

- **Resume Text Extractor** — Extract structured text from resume PDFs
- **Indian Payment Advice Parser** — Parse payment details from bank advices
- **Document Table Extractor** — Extract tables from document pages
- **PDF to PNG Converter** — Convert pages to images for OCR or vision AI

***

### Integration with n8n / Make.com

#### n8n HTTP Request Node

1. Set **Method** to `POST`
2. Use the Apify API endpoint to run this actor
3. Pass your PDF as binary data or provide a URL
4. Use `dataset_base64` output for easy downstream processing

#### Make.com

1. Use the **Apify** module to run this actor
2. Pass your PDF URL in the `pdfUrl` input field
3. Iterate over dataset results for downstream processing

***

### Limits

| Resource | Limit |
|----------|-------|
| File size | 500 MB |
| Page count | 50,000 pages |
| Default memory | 256 MB |
| Max memory | 4096 MB |

#### Memory recommendations

| PDF Size | Pages | Recommended Memory |
|----------|-------|--------------------|
| ≤ 10 MB | ≤ 100 | 256 MB |
| ≤ 50 MB | ≤ 500 | 512 MB |
| ≤ 200 MB | ≤ 2,000 | 1024 MB |
| ≤ 500 MB | ≤ 5,000 | 2048 MB |
| > 500 MB | > 5,000 | 4096 MB |

> **Tip:** For PDFs with 1,000+ pages, use `key_value_store` output format instead of `dataset_base64` to avoid base64 encoding overhead.

***

### Changelog

#### v0.2 (Large PDF Support)

- Flat per-run pricing ($0.005 per run, unlimited pages)
- Raised limits: 50,000 pages, 500 MB file size, 4 GB memory
- Streaming download for large files
- Batch dataset pushes (50 rows per API call)
- Aggressive memory cleanup with gc for 10K+ page PDFs
- Progress logging every 100 pages
- Memory recommendations in logs

#### v0.1 (Initial Release)

- PDF splitting with page selection (`all`, ranges, specific pages)
- Two output modes: Dataset (base64) and Key-Value Store (binary)
- File upload and URL input support
- Memory-efficient processing with periodic cleanup

# Actor input Schema

## `pdfFile` (type: `string`):

Upload a PDF file to split. The file will be stored in a key-value store and its URL passed here.

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

Direct URL to a PDF file. Use this when chaining from another actor or when the PDF is hosted online. If both pdfFile and pdfUrl are provided, pdfFile takes priority.

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

Which pages to extract. Examples: 'all' (every page), '1' (first page only), '1,3,5' (specific pages), '1-5' (range), '1,3-5,7' (mixed). Default: all pages.

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

How to output the split pages. 'Dataset (base64)' stores each page as a JSON row with base64-encoded PDF — best for chaining to other actors. 'Key-Value Store' saves each page as a binary PDF file — best for direct download.

## Actor input object example

```json
{
  "pdfUrl": "https://www.w3.org/WAI/WCAG21/Techniques/pdf/img/table-word.pdf",
  "pages": "all",
  "outputFormat": "dataset_base64"
}
```

# Actor output Schema

## `splitPages` (type: `string`):

Each row contains a single split page with page\_number, filename, size\_bytes, content\_base64, original\_filename, and total\_pages fields.

## `splitFiles` (type: `string`):

Binary PDF files saved as page\_N\_filename.pdf in the default key-value store. Only populated when outputFormat is set to key\_value\_store.

# 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.w3.org/WAI/WCAG21/Techniques/pdf/img/table-word.pdf"
};

// Run the Actor and wait for it to finish
const run = await client.actor("vivianferreira/pdf-page-splitter").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.w3.org/WAI/WCAG21/Techniques/pdf/img/table-word.pdf" }

# Run the Actor and wait for it to finish
run = client.actor("vivianferreira/pdf-page-splitter").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 '{
  "pdfUrl": "https://www.w3.org/WAI/WCAG21/Techniques/pdf/img/table-word.pdf"
}' |
apify call vivianferreira/pdf-page-splitter --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Pdf Page Splitter",
        "description": "Split any PDF into individual pages instantly. Extract all pages, specific pages (1,3,5), or ranges (1-5). Handles up to 50,000 pages. Flat $0.005 per run. Perfect first step for document processing pipelines — chain with OCR, table extraction, and text analysis actors.",
        "version": "0.2",
        "x-build-id": "bGC3ZDm5qpheJQS3Q"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/vivianferreira~pdf-page-splitter/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-vivianferreira-pdf-page-splitter",
                "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/vivianferreira~pdf-page-splitter/runs": {
            "post": {
                "operationId": "runs-sync-vivianferreira-pdf-page-splitter",
                "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/vivianferreira~pdf-page-splitter/run-sync": {
            "post": {
                "operationId": "run-sync-vivianferreira-pdf-page-splitter",
                "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",
                "properties": {
                    "pdfFile": {
                        "title": "Upload PDF",
                        "type": "string",
                        "description": "Upload a PDF file to split. The file will be stored in a key-value store and its URL passed here."
                    },
                    "pdfUrl": {
                        "title": "OR: PDF URL",
                        "type": "string",
                        "description": "Direct URL to a PDF file. Use this when chaining from another actor or when the PDF is hosted online. If both pdfFile and pdfUrl are provided, pdfFile takes priority."
                    },
                    "pages": {
                        "title": "Pages to extract",
                        "type": "string",
                        "description": "Which pages to extract. Examples: 'all' (every page), '1' (first page only), '1,3,5' (specific pages), '1-5' (range), '1,3-5,7' (mixed). Default: all pages.",
                        "default": "all"
                    },
                    "outputFormat": {
                        "title": "Output format",
                        "enum": [
                            "dataset_base64",
                            "key_value_store"
                        ],
                        "type": "string",
                        "description": "How to output the split pages. 'Dataset (base64)' stores each page as a JSON row with base64-encoded PDF — best for chaining to other actors. 'Key-Value Store' saves each page as a binary PDF file — best for direct download.",
                        "default": "dataset_base64"
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
