Split PDF Files with PDF.coThe PDF Splitter API can split a PDF document of any size. There are two ways to split a PDF document using the API.

The split by page allows you to define a specific page index and range while the split by text lets you set search strings to guide the splitter.

All the PDF documents that you send and generate using our API are secured and encrypted. The files generated by our server expires in 1 hour by default. For more information about PDF.co API Security, check out https://pdf.co/security

SIGN UP FOR FREE

PDF Splitter API Benefits

Split PDF by Page Index

The PDF Splitter API is very flexible when splitting a PDF document by page. You can specify the page indexes you want to split by using the page number, the inverted page numbers, or use the special symbol asterisk "*" to split the document into separate pages.

Split PDF by Text

The Split by Text function uses search string and /or regex search to split the PDF pages. When splitting by search string, the engine will find the specified string in the individual pages and split it the moment it finds the string. While the regex search finds the regular expression pattern in the pages.

Split into Multiple PDF Files

The PDF Splitter API can split a PDF document into multiple PDF files. There’s no limitation to the number of pages that you can split as long as the conditions set in the PDF Splitter API endpoints are met.

On-Premise API Server

We have the on-premise API Server and an on-demand version of The PDF Splitter API module. The on-premise API Server can easily be configured for optimal and better performance. It can also be customized for your specific module needs.

PDF Splitter API Integrations

We launched many integrations of our API and solid business automation platforms. See below for sample tutorials.

PDF.co API integrates with over 300+ more online apps ready. You can swiftly connect with the most common applications through our PDF.co API integrations.

PDF Splitter API Sample & Demo

Check the source codes below:

Split by Page

We will start our demonstration using the /v1/pdf/split endpoint. We have a 4-page PDF document that we will split into 2 PDF documents. Pages 1-2 will be PDF 1 and pages 3-4 will be PDF 2.

Once we have successfully split the PDF document, we will have 2 separate PDFs. The PDFs will look like these.

PDF Split By Page Source File
Split By Page Source File
PDF Splitter By Page Output PDF
Split By Page Output PDFs

Let’s review the /v1/pdf/split endpoint’s parameters and their corresponding uses real quick.

Endpoint

URL: https://api.pdf.co/v1/pdf/split
Method: POST
Parameter Description
url required. Link to the source file.
pages define comma-separated page index or range. See API Docs for samples.
encrypt optional. Enable encryption to the output file.
async optional. Runs processing asynchronously. Returns jobId to use with job/check: true or false
name optional. Output file name.
profiles optional. Must be a String. Set custom configuration. See profiles examples here

 

cURL Code Snippet

curl --location --request POST 'https://api.pdf.co/v1/pdf/split' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{x-api-key}}' \
--data-raw '{
    "url": "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf",
    "pages": "1-2,3-",
    "name": "result.pdf"
}'

Let’s see the PDF Splitter by Page using the cURL Code Snippet above.

PDF Splitter By Page In Action
Calling /v1/pdf/spit using cURL

PDF Splitter JavaScript codes are located in our repository here.

PDF Splitter PHP codes are located in our repository here.

PDF Splitter Python codes are located in our repository here.

PDF Splitter Java codes are located in our repository here.

PDF Splitter C# sample codes are located in our repository here.

Sign Up

Split by Text

Now, let’s demonstrate the /v1/pdf/split2 endpoint. We will use a 3-page PDF invoice and split the pages every time the engine finds the string Invoice Number.

Once the request has been processed, the output will look like this.

PDF Invoice As Source File For PDF Splitter
Split by Text Source File
PDF.co PDF Splitter Split By Search Text Output
Split by Text Output Files

Let’s run over the /v1/pdf/split2 endpoint’s parameters and their corresponding functions.

Endpoint

URL: https://api.pdf.co/v1/pdf/split2
Method: POST
Parameter Description
url required. Link to the source file.
searchString required. Text to search for on pages.
excludeKeyPages optional. Set to true if you want to exclude pages where text was found.
regexSearch optional. Set to true to enable regex search.
caseSensitive optional. Set to true to enable case-sensitive search.
lang optional. eng by default.
encrypt optional. Enable encryption to output file.
async optional. Runs processing asynchronously. Returns jobId to use with job/check: true or false
name optional. Output file name.
profiles optional. Must be a String. Set custom configuration. See profiles examples here

cURL Code Sample

curl --location --request POST 'https://api.pdf.co/v1/pdf/split2' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{x-api-key}}' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-split/multiple-invoices.pdf",
    "searchString": "Invoice Number",
    "name": "result.pdf"
}'

The Split by Text cURL sample codes are available here.

Let’s see the PDF Splitter Split by Text in action using the sample cURL code.

PDF Splitter Split By Search String Using Curl In Visual Studio Code
Calling PDF Splitter /v1/pdf/split2 endpoint using cURL

The Split by Text JavaScript sample codes are available here.

The Split by Text PHP sample codes are available here.

The Split by Text Python codes are located in our repository here.

The Split by Text Java sample codes are available here.

The Split by Text C# sample codes are available here.

Sign Up

Why Use Our API to Split PDF Documents?

Split Large Files

Our PDF splitter API can split large and small files with ease, and it all happens in the cloud. In that regard, our API makes splitting large files as easy as splitting small files.

Auto Choose Where the PDF Files Split

Our PDF Split API allows you to input the page numbers you would want to split from the main document. Therefore, you do not have to open the document and browse/scroll through the document to choose which pages to split.

Securely Split PDF Pages

Security is important when handling confidential data such as ePHI. Therefore, for every document you upload to our API temporary storage, the app secures it with end-to-end SSL\TLS encryption.

That guarantees your documents remain private and protected from unauthorized third parties.

Asynchronously Split PDF into Multiple Files

With our PDF page splitter’s asynchronous splitting feature, you can have multiple large files being split simultaneously and in the background. You then wait for the split PDF files to be output, and then download them.

The first step to enabling the asynchronous mode of splitting is setting the “async” input parameter to “true.” That will force the splitting process to run in the background. You may use the “/job/check” code to get it to return the “Success” status when the files are ready.

Related Samples: