Split PDF using PHP
Split PDF files into pages and save them in individual PDF. Extract pages from a PDF to create a new PDF Document.
File conversion library for PHP
ConvertAPI provides a PHP library that allows you to perform a Split PDF conversion with just a few lines of code. Split PDF documents using PHP programming language with no effort at all!
composer require convertapi/convertapi-php
Or install it manually using ConvertApi autoloader:
require_once('/path/to/convertapi-php/lib/ConvertApi/autoload.php');
How To Split PDF using PHP?
You can Split PDF in a few simple steps:
- Obtain your secret key by signing up for a free account.
- Install the ConvertAPI library for PHP
- Set up the Split PDF conversion using our live demo tool
- Copy-paste the auto-generated code snippet into your project!
Split PDF - complete code snippet for PHP
Once you have your authentication in place, simply copy-paste this pdf to split conversion code snippet into your PHP project:
Upload the file and see how it works
You can set up the advanced conversion parameters and test the conversion result online using our interactive demo tool. It will auto-generate the code snippet for you!
Advanced Split PDF conversion parameters
Sets the password to open protected documents.
Split PDF into chunks of pages by a pattern. For example, if you set 3,2 for a ten-page PDF, it would be divided into four PDF files that contain 3,2,3,2 pages accordingly. The pattern is repeated until there are no pages left.
Split PDF by a custom range. Individual page numbers separated by commas or page ranges are supported and can be combined. For example, if set 1,3,4-5,6-9 for a ten-page PDF, it would create four PDF documents - the first PDF contains only the first page, the second PDF contains the third page, the third PDF contains pages from 3 to 5, and the last PDF contains pages from 6 to 9.
Each page included in this range will be split individually (one page per document). A page range or individual page numbers separated by a comma is supported (see SplitByCustomRange description for a detailed explanation).
Merge all ranges in one PDF file.
It tries to produce smaller output files but requires Adobe Reader 6, released in 2003 or newer, to view created PDF files.