Split PDF API

Programmatically Divide Large PDF Files into Smaller, Manageable Documents.

hero banner

Code Examples in Popular Languages

Integrate our Split PDF API easily into your apps with comprehensive code examples in popular languages to get started quickly.

CURL Request
curl --location 'https://theonlineconverter.com/api/v1/split-pdf' \
--header 'Content-Type: application/json' \
--header 'x-api-key: enter_your_api_key' \
--form 'file=@"/D:/data/Document/pdf/progit.pdf"' \
--form 'ranges[]="3,7,12"' \
--form 'merge="true"'
JavaScript Fetch
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "enter_your_api_key");

const formdata = new FormData();
formdata.append("file", fileInput.files[0], "/D:/data/Document/pdf/progit.pdf");
formdata.append("ranges[]", "3,7,12");
formdata.append("merge", "true");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: formdata,
  redirect: "follow"
};

fetch("https://theonlineconverter.com/api/v1/split-pdf", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
Ruby Net::HTTP
import requests
import json

url = "https://theonlineconverter.com/api/v1/split-pdf"

payload = {'ranges[]': '3,7,12',
'merge': 'true'}
files=[
  ('file',('progit.pdf',open('/D:/data/Document/pdf/progit.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
Python Requests
import requests
import json

url = "https://theonlineconverter.com/api/v1/split-pdf"

payload = {'ranges[]': '3,7,12',
'merge': 'true'}
files=[
  ('file',('progit.pdf',open('/D:/data/Document/pdf/progit.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
PHP Guzzle
<?php
$client = new Client();
$headers = [
  'Content-Type' => 'application/json',
  'x-api-key' => 'enter_your_api_key'
];
$options = [
  'multipart' => [
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/D:/data/Document/pdf/progit.pdf', 'r'),
      'filename' => '/D:/data/Document/pdf/progit.pdf',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ],
    [
      'name' => 'ranges[]',
      'contents' => '3,7,12'
    ],
    [
      'name' => 'merge',
      'contents' => 'true'
    ]
]];
$request = new Request('POST', 'https://theonlineconverter.com/api/v1/split-pdf', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Java HttpURLConnection
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("file","/D:/data/Document/pdf/progit.pdf",
    RequestBody.create(MediaType.parse("application/octet-stream"),
    new File("/D:/data/Document/pdf/progit.pdf")))
  .addFormDataPart("ranges[]","3,7,12")
  .addFormDataPart("merge","true")
  .build();
Request request = new Request.Builder()
  .url("https://theonlineconverter.com/api/v1/split-pdf")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("x-api-key", "enter_your_api_key")
  .build();
Response response = client.newCall(request).execute();
Go net/http
package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "os"
  "path/filepath"
  "net/http"
  "io"
)

func main() {

  url := "https://theonlineconverter.com/api/v1/split-pdf"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  file, errFile1 := os.Open("/D:/data/Document/pdf/progit.pdf")
  defer file.Close()
  part1,
         errFile1 := writer.CreateFormFile("file",filepath.Base("/D:/data/Document/pdf/progit.pdf"))
  _, errFile1 = io.Copy(part1, file)
  if errFile1 != nil {
    fmt.Println(errFile1)
    return
  }
  _ = writer.WriteField("ranges[]", "3,7,12")
  _ = writer.WriteField("merge", "true")
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("x-api-key", "enter_your_api_key")

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
C# HttpClient
var options = new RestClientOptions("https://theonlineconverter.com")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/v1/split-pdf", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-api-key", "enter_your_api_key");
request.AlwaysMultipartFormData = true;
request.AddFile("file", "/D:/data/Document/pdf/progit.pdf");
request.AddParameter("ranges[]", "3,7,12");
request.AddParameter("merge", "true");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Key Features & Capabilities

Our Split PDF API is designed with flexible and powerful features to handle any document separation task.

Simple User Interface

Multiple Split Modes

Choose how to divide your PDF: split every page into a separate file, define custom page ranges, or split into fixed chunks (e.g., every 2 pages).

Simple Data Format

Extract Specific Pages

Easily extract a single page or a precise set of non-consecutive pages from a large document into a new PDF.

Time

High-Fidelity Output

The splitting process is lossless, ensuring that the quality, formatting, annotations, and orientation of the original pages are perfectly preserved.

Secure Data

Structured File Output

Receive your newly created PDF files in a convenient format, such as a single ZIP archive containing all the documents, or a JSON response with links to each file.

Universal Access

Fast & Scalable Performance

Engineered for speed, our API processes split jobs in seconds and is built to scale, handling large files and high-volume requests reliably.

Freedom

Secure & Confidential

All files are processed over encrypted connections. We guarantee document confidentiality with a strict data privacy policy and do not store your files.

Frequently Asked Questions

Find answers to common questions about our Split PDF API to help you integrate and use the service effectively.

You can split a PDF in three main ways: split every single page into its own PDF, split into fixed-size files (e.g., a new PDF for every 2 pages), or define specific, custom page ranges (e.g., pages 1-5 in one file, pages 8-10 in another).

Yes. By using the "ranges" split mode, you can specify a single page (e.g., "5-5" or just "5") to extract it as a new, one-page PDF.

The API will typically return a single downloadable ZIP file containing all the generated PDFs, or a JSON response with individual download links for each new file.

No, the process is lossless. The text, images, and layout of the extracted pages will have the exact same quality as they did in the original document.

Your original PDF file is only used for reading and is never modified or deleted. It remains completely intact.

Yes, but you must provide the correct password in your API request. This allows us to decrypt the file for processing.

Absolutely. We use TLS encryption for all data transfers, and your files are permanently deleted from our servers immediately after the split operation is completed.