IRONSOFTWAREHOME
Split a PDF and Extract Pages
from ironpdf import *

html = """<p> Hello Iron </p>
          <p> This is 1st Page </p>
          <div style='page-break-after: always;'></div>
          <p> This is 2nd Page</p>
          <div style='page-break-after: always;'></div>
          <p> This is 3rd Page</p>"""

renderer = ChromePdfRenderer()
pdf = renderer.RenderHtmlAsPdf(html)

# take the first page
page1doc = pdf.CopyPage(0)
page1doc.SaveAs("Split1.pdf")

# take the pages 2 & 3
page23doc = pdf.CopyPages(1, 2)
page23doc.SaveAs("Split2.pdf")
pip install ironpdf
Split a PDF and Extract Pages

Split a PDF and Extract Pages

IronPDF for Python can split a PDF document into multiple separate files by copying specific pages or page ranges from the original document.

Getting Started

Create or load a multi-page PdfDocument, then use CopyPage to extract a single page or CopyPages to extract a range of pages. Each call returns a new PdfDocument containing only the specified pages, which can then be saved independently.

Understanding the Code

  • RenderHtmlAsPdf(html): Renders a multi-page HTML document (using page-break-after: always to create page breaks) into a PdfDocument.
  • CopyPage(index): Returns a new single-page PdfDocument containing the page at the given zero-based index. In the example, index 0 extracts the first page.
  • CopyPages(start, end): Returns a new PdfDocument containing the pages from start to end (inclusive, zero-based). In the example, indexes 1 and 2 extract pages 2 and 3.
  • SaveAs(path): Saves each resulting document to its own file.

Zero-Based Indexing

IronPDF uses zero-based page indexing throughout its API. Page 1 of a document is at index 0, page 2 is at index 1, and so on.

Learn to merge and split PDFs with IronPDF for Python!

Ready to Get Started?

Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF for Python
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Python Module Download for PDF
Install with pip

Version: 2026.9

  1. Download and install Python 3.7+.
  2. Install pip from pypi.org if it isn't installed already.
  3. Execute the above command in the terminal.
Python PDF Module
Download Module

Version: 2026.9

Manually install into your project

  1. Download the package
  2. Run this command from the terminal
    pip install ironpdf-2026.9-py37-none-win_amd64.whi

Licenses from $999