Split PDF Guide
How to integrate the Split PDF tool into your application using iLovePDF’s REST API.
There are several ways to split a PDF but the most simple one is by defining ranges of pages to split:
The property ranges can define multiple page ranges to split your document. You’ll have as a result a packaged file to download with as many files as ranges you have set.
According to this code example, the final output will be of two zipped PDF files. One will contain the pages from 2 to 4 and the other will contain pages 6 to 8.
Note that if you set a range greater than the maximum number of pages in your document, you will get as many pages as can be split from this document. However, if your range starts with a page number greater than the number of pages in your document, you will receive an error and the process will fail.
We have seen how to split a document by page ranges, but there are more ways to split. See the following:
Split by fixed ranges
fixed_range will split your PDF every n pages. If you set a bigger fixed range number than the number of pages in your document, you will receive an error.
Split by removing pages
remove_pages allows you to set ranges of pages to be removed from your document and the resulting file comes back as a single PDF without the specified pages.
Merge after split
When you split a document by setting specific ranges you can merge all these ranges together in a single file with merge_after. You will get as a result a single PDF file.