Split PDF using Python
Split PDF files into pages and save them in individual PDF. Extract pages from a PDF to create a new PDF Document.
Split PDF features
Split PDF files into pages and save them in individual PDF. Extract pages from a PDF to create a new PDF Document.
ConvertAPI Python library install
ConvertAPI provides a Python library that allows you to perform a Split PDF conversion with just a few lines of code. Split PDF documents using Python SDK with no effort at all!
pip install --upgrade convertapi
Authenticate your Python library
You can obtain your secret key by signing up for a free account. Once you sign up, you'll receive 250 free conversions instantly! Grab your authentication secret from the account dashboard, and authenticate the ConvertAPI Python library like this:
import convertapi
convertapi.api_credentials = 'secret_or_token'
Split PDF using Python in no time!
Once you have your authentication in place, simply copy-paste this pdf to split conversion code snippet into your Python project:
Try the conversion online - no coding required!
You can try out advanced conversion parameters and test the conversion result online using our interactive demo tool. This tool will produce the same conversion output as if you were using the library from your solution, and it will auto-generate the code snippet for you!
Try for FREE!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.
Split PDF by identifying text segments matching a specific regex pattern. This allows the document to be divided into separate files at each occurrence of the specified pattern, ideal for segmenting content by recurring headings, section labels, or custom text markers.
For example, setting Chapter \d+:
splits the PDF at each chapter title, such as Chapter 1:
, Chapter 2:
, etc.
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.