Split PDF Pages – Step-by-Step Guide

  1. Install Requests Module
  2. Add API Key
  3. Source File and Pages
  4. Run Program
  5. PDF Split Web API Demo

In this demonstration, we will split PDF pages in Python using the PDF.co Web API. We will use this /v1/pdf/split2 endpoint. . Below is the sample PDF with 4-pages and the output with split pages.

Sample and Output PDF
Sample and Output PDF

Step 1: Install Requests Module

First, kindly install the requests module. If you already have the requests module. Kindly type the python -m pip install requests in your command line and run to access the pip requests.

Step 2: Add API Key

Add your API key to your sample Python code. You may get your API key here.

PDF.co API Key

Step 3: Source File and Pages

In lines 22-24, add your source PDF file and enter the pages with separated-comma to split.

Source File and Pages

Step 4: Run Program

You can now run your Python program, and you will see the output PDF in your folder.

Run Program

Step 5: PDF Split Web API Demo

Here’s the PDF Split Web API in action.

PDF Split Web API in Python
PDF Split Web API in Python

In this tutorial, you learned how to split PDF pages in Python using the PDF.co Web API. You learned how to use the PDF Split Web API to split PDF pages. You also learned how to install the requests module and access the pip install requests.

Related Samples: