Copying Pages between PDF Files

IronPDF for Python can copy pages from one PDF document and insert them into another at any position — at the end, the beginning, or a specific page index within the target document.

Getting Started

Create or load two PdfDocument objects. Use CopyPage to extract a specific page from the source document, then insert it into the target document using one of the three insertion methods.

Understanding the Code

  • CopyPage(index): Extracts a single page from a PdfDocument by its zero-based index. Returns a new single-page PdfDocument.
  • AppendPdf(page_to_insert): Adds the page to the end of the target document.
  • PrependPdf(page_to_insert): Adds the page to the beginning of the target document, before all existing pages.
  • InsertPdf(page_to_insert, index): Inserts the page at the specified zero-based position within the target document. In the example, index 1 inserts the page after the first page.

Inserting Multiple Pages

To copy and insert multiple pages at once, use CopyPages(start, end) instead of CopyPage, then insert the resulting multi-page document using the same AppendPdf, PrependPdf, or InsertPdf methods.

Learn to merge and edit PDF pages with IronPDF for Python!

Ready to Get Started?
Version: 2026.6 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast?
run a sample watch your HTML become a PDF.