IRONSOFTWAREHOME
Merge Multiple PDFs with a Cover Page

from ironpdf import *

# Instantiate Renderer
renderer = ChromePdfRenderer()

# Join Multiple Existing PDFs into a single document
pdfs = List[PdfDocument]()
pdfs.Add(PdfDocument.FromFile("A.pdf"))
pdfs.Add(PdfDocument.FromFile("B.pdf"))
pdfs.Add(PdfDocument.FromFile("C.pdf"))
pdf = PdfDocument.Merge(pdfs)
pdf.SaveAs("merged.pdf")
 
# Add a cover page
pdf.PrependPdf(renderer.RenderHtmlAsPdf("<h1>Cover Page</h1><hr>"))
 
# Remove the last page from the PDF and save again
pdf.RemovePage(pdf.PageCount - 1)
pdf.SaveAs("merged.pdf")
 
# Copy pages 5-7 and save them as a new document.
pdf.CopyPages(ToPageList([4, 6])).SaveAs("excerpt.pdf")
 
for eachPdf in pdfs:
    eachPdf.Dispose()
NuGet Download
Install-Package ironpdf
Merge Multiple PDFs with a Cover Page

Merge Multiple PDFs with a Cover Page

IronPDF for Python provides a concise set of methods for combining, restructuring, and extracting pages from PDF documents - merging multiple files, prepending cover pages, removing pages, and copying page subsets in just a few lines of code.

Getting Started

Load existing PDFs into a typed List[PdfDocument] collection and pass it to PdfDocument.Merge to combine them. From there, use PrependPdf, RemovePage, and CopyPages to further shape the document before saving.

Understanding the Code

  • List[PdfDocument](): A typed .NET-style list used to collect multiple PdfDocument objects before merging. Call .Add() to append each document.
  • PdfDocument.FromFile(path): Opens an existing PDF file and returns it as a PdfDocument object.
  • PdfDocument.Merge(pdfs): Combines all documents in the list into a single PdfDocument, preserving page order.
  • SaveAs(path): Writes the current state of the document to disk.
  • PrependPdf(pdf): Inserts another PdfDocument at the very beginning of the current document - used here to add a rendered HTML cover page as the first page.
  • RemovePage(index): Removes a single page at the specified zero-based index. pdf.PageCount - 1 targets the last page.
  • CopyPages(ToPageList([4, 6])): Extracts specific pages by their zero-based indexes and returns them as a new PdfDocument. ToPageList converts a Python list of indexes into the required page list format.
  • eachPdf.Dispose(): Releases the underlying resources held by each loaded PdfDocument after the merge is complete.

Zero-Based Page Indexing

All page operations in IronPDF use zero-based indexes. Page 5 of a document is at index 4, page 7 is at index 6, and so on.

Learn to merge and edit PDFs with IronPDF for Python!

Ready to Get Started?

Version:2026.8just released

Key in blue circle

Get your free 30-day Trial Key instantly.

No limitations. 100% unlocked. No credit card.

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
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