What it does
Split a PDF by page ranges, every few pages, one file per page, at bookmarks, by file size or where the content changes.
It reads one PDF file. You get: one PDF, or a ZIP of PDFs when there are several parts.
Step by step on the website
Use Split PDF
Open Split PDF on the website.
Open Split PDFDrop your PDF file on the page, or choose it.
Choose your settings, or keep the ones already chosen:
- Mode: By page ranges, Every N pages, Every page, By bookmarks, By file size, By content or Very long PDFs (By page ranges at first). How to cut the PDF into parts.
- Page ranges: type page numbers and ranges, such as 1-3, 5. Each range becomes its own PDF, such as 1-3, 4-8. Appears when Mode is By page ranges.
- Ranges into: switch it on or off. One PDF with all the ranges, or one PDF per range. Appears when Mode is By page ranges.
- Pages per part: a number from 1 to 5000 pages (1 page at first). Start a new file after this many pages. Appears when Mode is Every N pages.
- Target size: a number from 1 to 10240. The size each part should stay under. Appears when Mode is By file size.
- Unit: KB or MB (MB at first). The unit of the target size. Appears when Mode is By file size.
- Pages per file: a number from 1 to 250 pages (50 pages at first). Start a new file after this many pages. Appears when Mode is Very long PDFs.
- Page limit: a number from 1 to 5000 pages (1500 pages at first). A safety cap on how many pages to read. Appears when Mode is Very long PDFs.
- Fall back to content breaks: switch it on or off (On at first). Used when the PDF has no bookmarks to split at. Appears when Mode is By bookmarks.
To fine-tune, open More options:
- File name: type a name, or keep the one suggested. Optional. The extension is added for you.
Select Split PDF to run it.
When it finishes, select Download to save your ZIP file.
Settings
Every setting, with the name the page shows and the name the API uses. On the page: shown next to your file. More options: under More options. API only: not offered on the website.
| Setting | API name | Choices or values | Default | Where | What it does |
|---|---|---|---|---|---|
| Mode | mode | By page ranges (ranges), Every N pages (interval), Every page (each), By bookmarks (smart), By file size (size), By content (content), Very long PDFs (large) | By page ranges | On the page | How to cut the PDF into parts. |
| Page ranges (required) | ranges | Text | On the page, when Mode is By page ranges | Each range becomes its own PDF, such as 1-3, 4-8. | |
| Ranges into | mergeRanges | On (true), Off (false) | On the page, when Mode is By page ranges | One PDF with all the ranges, or one PDF per range. | |
| Pages per part | interval | 1 to 5000 pages | 1 | On the page, when Mode is Every N pages | Start a new file after this many pages. |
| Target size (required) | targetSize | 1 to 10240 | On the page, when Mode is By file size | The size each part should stay under. | |
| Unit | targetUnit | KB (kb), MB (mb) | MB | On the page, when Mode is By file size | The unit of the target size. |
| Pages per file | pagesPerFile | 1 to 250 pages | 50 | On the page, when Mode is Very long PDFs | Start a new file after this many pages. |
| Page limit | maxPages | 1 to 5000 pages | 1500 | On the page, when Mode is Very long PDFs | A safety cap on how many pages to read. |
| Fall back to content breaks | allowFallback | On (true), Off (false) | On | On the page, when Mode is By bookmarks | Used when the PDF has no bookmarks to split at. |
| File name | outputName | Text | More options | Optional. The extension is added for you. |
Run it with the API
Upload your file with POST /api/v2/documents, then start Split PDF with POST /api/v2/document-operations and toolId split-pdf. The parameters use the API names in the settings table; anything you leave out takes its default. Read the operation until its state is completed, then download the output version.
The request below uses the same starting settings as the website. The script after it does the whole journey: upload, run, wait and download.
{
"documentId": "doc_8kq2W1",
"versionId": "ver_3Jx9Lm",
"toolId": "split-pdf",
"parameters": {
"ranges": "1-3"
},
"idempotencyKey": "split-pdf-2026-11-22-1"
}#!/usr/bin/env bash
# Needs curl and jq.
# Your API key: set WELLFRIEND_API_KEY, or replace YOUR_API_KEY (keys: https://wellfriend.dev/dashboard/developer-api/keys).
set -euo pipefail
API="${WELLFRIEND_API_URL:-https://wellfriend.dev}"
WELLFRIEND_API_KEY="${WELLFRIEND_API_KEY:-YOUR_API_KEY}"
AUTH="Authorization: Bearer $WELLFRIEND_API_KEY"
RUN=$(uuidgen) # reuse this value to retry safely
# upload FILE CONTENT_TYPE KEY: prints the document id and its version id
upload() {
curl -sS --fail-with-body -X POST "$API/api/v2/documents" -H "$AUTH" -H "Idempotency-Key: $3" \
-H "Content-Type: $2" -H "X-Wellfriend-Filename: $(basename "$1")" --data-binary "@$1" \
| jq -r '"\(.document.id) \(.document.currentVersion.id)"'
}
read -r DOCUMENT_ID VERSION_ID < <(upload 'input.pdf' 'application/pdf' "$RUN-upload")
# Run split-pdf
OP=$(jq -n --arg doc "$DOCUMENT_ID" --arg ver "$VERSION_ID" --arg key "$RUN-1" \
--argjson parameters '{"ranges":"1-3"}' \
'{documentId: $doc, versionId: $ver, toolId: "split-pdf", parameters: $parameters, idempotencyKey: $key}' \
| curl -sS --fail-with-body -X POST "$API/api/v2/document-operations" -H "$AUTH" \
-H "Content-Type: application/json" -H "Idempotency-Key: $RUN-1" --data-binary @- | jq -r .operation.id)
while :; do
RESULT=$(curl -sS --fail-with-body "$API/api/v2/document-operations/$OP" -H "$AUTH")
STATE=$(echo "$RESULT" | jq -r .operation.state)
case "$STATE" in completed) break ;; failed|cancelled|canceled) echo "$RESULT" >&2; exit 1 ;; esac
sleep 1
done
DOCUMENT_ID=$(echo "$RESULT" | jq -r .operation.outputDocumentId)
VERSION_ID=$(echo "$RESULT" | jq -r .operation.outputVersionId)
# Download the result
curl -sS --fail-with-body "$API/api/v2/documents/$DOCUMENT_ID/versions/$VERSION_ID/content" -H "$AUTH" -o 'input-wellfriend.zip'Run it with the SDKs
The SDKs upload the file, run split-pdf with the same parameters and wait for the result: wf.tools.splitPdf() in TypeScript, wf.tools.split_pdf() in Python, wf.Tools.SplitPDF() in Go.
// wellfriend-document-sdk: npm install wellfriend-document-sdk@latest. An ES module (top-level await): save it as .mts.
// Your API key: set WELLFRIEND_API_KEY, or replace YOUR_API_KEY (keys: https://wellfriend.dev/dashboard/developer-api/keys).
import { Wellfriend } from "wellfriend-document-sdk";
const wf = new Wellfriend({ apiKey: process.env.WELLFRIEND_API_KEY ?? "YOUR_API_KEY" });
const result = await wf.tools.splitPdf("input.pdf", { ranges: "1-3" });
await result.save("input-wellfriend.zip");# wellfriend-document-sdk: pip install -U wellfriend-document-sdk
# Your API key: set WELLFRIEND_API_KEY, or replace YOUR_API_KEY (keys: https://wellfriend.dev/dashboard/developer-api/keys).
import os
from wellfriend import Wellfriend
wf = Wellfriend(api_key=os.environ.get("WELLFRIEND_API_KEY", "YOUR_API_KEY"))
result = wf.tools.split_pdf("input.pdf", ranges="1-3")
result.save("input-wellfriend.zip")// go get wellfriend.dev/go/wellfriend@latest
package main
import (
"context"
"fmt"
"os"
"wellfriend.dev/go/wellfriend"
)
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func run() error {
// Your API key: set WELLFRIEND_API_KEY, or replace YOUR_API_KEY (keys: https://wellfriend.dev/dashboard/developer-api/keys).
apiKey := os.Getenv("WELLFRIEND_API_KEY")
if apiKey == "" {
apiKey = "YOUR_API_KEY"
}
wf := wellfriend.New(wellfriend.WithAPIKey(apiKey))
ctx := context.Background()
res, err := wf.Tools.SplitPDF(ctx, wellfriend.File("input.pdf"), &wellfriend.SplitPDFParams{Ranges: wellfriend.String("1-3")})
if err != nil {
return err
}
return res.Save(ctx, "input-wellfriend.zip")
}