The 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 are secured and encrypted. For more information about PDF.co API Security, check out https://pdf.co/security
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.
Web API Supports Multiple Languages
PDF.co platform can be used by software developers from programming languages such as PHP, Javascript, .NET and ASP.NET, C#, Java, Visual Basic, and many others. Find source code samples in our API documentation.
Business Automation Platforms Integrations
If you are not a developer, you can also easily automate your PDF operations via popular business automation platforms: Zapier, Make, Airtable, Salesforce, Google Apps Script, and 300+ more.
SIGN UP FOR FREE
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.
Split By Page Source File
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" }'
The Split by Pages cURL source code samples are available here.
Let’s see the PDF Splitter by Page using the cURL Code Snippet above.
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# source code samples are located in our repository here.
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.
Split by Text Source File
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 source code samples is available here.
Let’s see the PDF Splitter Split by Text in action using the sample cURL code.
Calling PDF Splitter /v1/pdf/split2 endpoint using cURL
The Split by Text JavaScript source code samples are available here.
The Split by Text PHP source code samples are available here.
The Split by Text Python codes are located in our repository here.
The Split by Text Java source code samples are available here.
The Split by Text C# source code samples are available here.
Why Use Our API for Splitting 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. This guarantees the ultimate security of all your documents.