How to Add, Copy, and Delete PDF Pages in PDFs Using C#
IronPDF provides simple methods to add, copy, and delete pages in PDFs using C#. Use Merge or InsertPdf to add pages, CopyPage/CopyPages to duplicate pages, and RemovePage/RemovePages to delete unwanted pages from your PDF documents.
Start managing PDF pages with IronPDF. This example shows how to merge additional content into an existing PDF. IronPDF's methods enable page management with minimal code, simplifying integration into any C# project. Before starting, install IronPDF via NuGet to access these page manipulation features. The library supports Windows, Linux, and Mac platforms.
-
1Install IronPDF with NuGet Package Manager
-
2Copy and run this code snippet.
IronPdf.PdfDocument.FromFile("/input/path.pdf") .AppendPdf(IronPdf.PdfDocument.FromFile("/additional/path.pdf")) .SaveAs("/output/path.pdf");C# -
3Deploy to test on your live environment
Start using IronPDF in your project today with a free trial
Minimal Workflow (5 steps)
- Download the IronPDF Library for C#
- Add pages to PDF using the
MergeandInsertPdfmethods - Copy pages from PDF using the
CopyPageandCopyPagesmethods - Delete pages from PDF using the
RemovePageandRemovePagesmethods - Save and export your PDF
How Do I Add Pages to a PDF?
What Methods Can I Use to Add Pages?
Add pages to a PDF in one line of code. IronPDF offers multiple approaches for combining PDF documents. The Merge method is the simplest for appending entire documents. The Chrome rendering engine maintains all formatting, fonts, and layouts during merging. This engine provides pixel-perfect rendering that preserves document integrity.
This example generates a report PDF and adds a cover page. The Merge method combines both PDFs. Use these sample documents: download coverPage.pdf and download contentPage.pdf.
using IronPdf;
// Import cover page
PdfDocument coverPage = PdfDocument.FromFile("coverPage.pdf");
// Import content document
PdfDocument contentPage = PdfDocument.FromFile("contentPage.pdf");
// Merge the two documents
PdfDocument finalPdf = PdfDocument.Merge(coverPage, contentPage);
finalPdf.SaveAs("pdfWithCover.pdf");Imports IronPdf
' Import cover page
Private coverPage As PdfDocument = PdfDocument.FromFile("coverPage.pdf")
' Import content document
Private contentPage As PdfDocument = PdfDocument.FromFile("contentPage.pdf")
' Merge the two documents
Private finalPdf As PdfDocument = PdfDocument.Merge(coverPage, contentPage)
finalPdf.SaveAs("pdfWithCover.pdf")The Merge method accepts multiple PDF documents as parameters, combining numerous PDFs in one operation. This works well for assembling reports from various sources or creating documentation packages. For advanced merging scenarios, see our merge or split PDFs guide.
What Does the Output Look Like?
The code produces a single PDF file with the cover page at the front:
How Can I Insert Pages at Specific Positions?
Insert pages at any index using the InsertPdf method. This method provides precise control over page placement, ideal for complex document assembly. This example inserts 'coverPage.pdf' at the beginning of 'contentPage.pdf':
using IronPdf;
// Import cover page
PdfDocument coverPage = PdfDocument.FromFile("coverPage.pdf");
// Import content document
PdfDocument contentPage = PdfDocument.FromFile("contentPage.pdf");
// Insert PDF
contentPage.InsertPdf(coverPage, 0);Imports IronPdf
' Import cover page
Private coverPage As PdfDocument = PdfDocument.FromFile("coverPage.pdf")
' Import content document
Private contentPage As PdfDocument = PdfDocument.FromFile("contentPage.pdf")
' Insert PDF
contentPage.InsertPdf(coverPage, 0)The InsertPdf method accepts an index parameter (0 represents the first position). Insert pages at any valid position within the document's page range. For a 10-page document, use index 5 to insert after page 5. This flexibility enables dynamic documents that adapt to requirements.
When inserting pages, consider maintaining consistent headers and footers. Update the table of contents after modifying page structure. Apply custom margins or page orientation for formatting consistency.
How Do I Copy Pages from a PDF?
Which Methods Should I Use for Copying Pages?
Copy pages using CopyPage or CopyPages methods for single and multiple pages respectively. Both methods return a PdfDocument object containing the specified pages. Use these when extracting sections from larger documents or creating new documents from existing content.
For sensitive documents, apply security settings to control access and permissions. Add digital signatures to ensure document authenticity.
How Do I Copy Single vs Multiple Pages?
using IronPdf;
using System.Collections.Generic;
// Copy a single page into a new PDF object
PdfDocument myReport = PdfDocument.FromFile("report_final.pdf");
PdfDocument copyOfPageOne = myReport.CopyPage(0);
// Copy multiple pages into a new PDF object
PdfDocument copyOfFirstThreePages = myReport.CopyPages(new List<int> { 0, 1, 2 });Imports IronPdf
Imports System.Collections.Generic
' Copy a single page into a new PDF object
Private myReport As PdfDocument = PdfDocument.FromFile("report_final.pdf")
Private copyOfPageOne As PdfDocument = myReport.CopyPage(0)
' Copy multiple pages into a new PDF object
Private copyOfFirstThreePages As PdfDocument = myReport.CopyPages(New List(Of Integer) From {0, 1, 2})Page indices are zero-based (first page is index 0). When copying multiple pages, specify non-consecutive pages by passing any valid indices. For example, new List<int> { 0, 2, 4 } copies the 1st, 3rd, and 5th pages. This selective copying helps create summary documents or extract key sections.
After copying pages, add headers and footers or apply watermarks for branding. Consider adding page numbers for organization. Copied pages retain all original formatting, including fonts, images, and layout.
The IronSuite play a crucial role in our operations. These are tools that increase efficiencies across the business including creating floor plans and improving inventory management.
How Do I Delete Pages in a PDF?
What Are the Methods for Removing Pages?
Delete pages using RemovePage or RemovePages methods for single and multiple pages respectively. Page removal is permanent within the modified document object. The original file remains unchanged unless explicitly overwritten.
Before removing pages, extract text or images to preserve content. The removal process maintains integrity of remaining pages, including bookmarks and annotations. Form fields on remaining pages are preserved.
How Do I Remove Single vs Multiple Pages?
using IronPdf;
using System.Collections.Generic;
PdfDocument pdf = PdfDocument.FromFile("full_report.pdf");
// Remove a single page
pdf.RemovePage(0);
// Remove multiple pages
pdf.RemovePages(new List<int> { 2, 3 });Imports IronPdf
Imports System.Collections.Generic
Private pdf As PdfDocument = PdfDocument.FromFile("full_report.pdf")
' Remove a single page
pdf.RemovePage(0)
' Remove multiple pages
pdf.RemovePages(New List(Of Integer) From {2, 3})Multiple page indices are processed in descending order internally, ensuring accurate removal without index shifting concerns. To remove pages 2, 5, and 8 from a 10-page document, specify them in any order - IronPDF handles removal correctly.
Best Practices for Page Removal
Follow these page removal best practices:
- Create backups: Work with copies of important documents
- Validate page ranges: Ensure pages exist to avoid exceptions
- Check document integrity: Verify cross-references and links work
- Update metadata: Update document metadata to reflect changes
After modifying documents, save in various formats including standard PDF, PDF/A for archival, or compress to reduce size. For accessibility compliance, export as PDF/UA format.
What Should I Do Next?
Explore more capabilities in our tutorial: Organize PDFs. Try advanced features like merging PDFs from different sources, creating PDFs from HTML, or working with PDF forms.
For enterprise scenarios, use async and multithreading capabilities for large-scale operations. For cloud deployment, see our Azure and AWS guides.
Visit our API reference for all available methods and properties. Explore code examples for practical page management implementations.
Frequently Asked Questions
How can I add pages to a PDF using IronPDF?
To add pages to a PDF using IronPDF, you can use the `Merge` or `InsertPdf` methods. The `Merge` method combines entire PDF documents, and the `InsertPdf` method allows insertion at specific indices within a document.
What methods are available for copying pages from a PDF in IronPDF?
IronPDF offers `CopyPage` and `CopyPages` methods for copying. `CopyPage` is for individual pages, while `CopyPages` handles multiple pages, allowing you to specify exact page indices.
How do I delete pages from a PDF using IronPDF?
To delete pages from a PDF with IronPDF, use the `RemovePage` or `RemovePages` methods. These methods allow removal of single or multiple pages from the document, respectively.
Can IronPDF maintain document formatting during merging?
Yes, IronPDF maintains all formatting, fonts, and layouts during merging by using the Chrome rendering engine, ensuring pixel-perfect rendering.
Is it possible to insert a PDF page at a specific position using IronPDF?
Yes, with IronPDF's `InsertPdf` method, you can insert pages at any specified index, providing precise control over page placement in the document.
What should I ensure before removing pages from a PDF?
Before removing pages, it’s best to extract any necessary text or images and create backups to preserve important content. Also, verify cross-references to maintain document integrity.
How can I apply security settings to copied pages in IronPDF?
After copying pages using IronPDF, you can apply security settings and add digital signatures to control access and ensure document authenticity.
What happens to the original PDF when I use IronPDF to manipulate pages?
Using IronPDF's page manipulation functions does not alter the original PDF unless explicitly saved over. Modifications are applied to the document object in memory.
How can I ensure consistent formatting when modifying PDFs with IronPDF?
Consistent formatting in IronPDF can be maintained by updating headers, footers, page numbers, and applying consistent margins and orientations after any structural changes.
What are some best practices for deleting pages with IronPDF?
Some best practices include creating backups, validating page ranges before deletion, checking document integrity post-modification, and updating document metadata to reflect changes.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.