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.
Quickstart: Add, Copy, and Delete PDF Pages Instantly
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.
Get started making PDFs with NuGet now:
Install IronPDF with NuGet Package Manager
Copy and run this code snippet.
IronPdf.PdfDocument.FromFile("/input/path.pdf") .AppendPdf(IronPdf.PdfDocument.FromFile("/additional/path.pdf")) .SaveAs("/output/path.pdf");Deploy to test on your live environment
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.
:path=/static-assets/pdf/content-code-examples/how-to/add-copy-delete-pages-pdf-add.csusing 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");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':
:path=/static-assets/pdf/content-code-examples/how-to/add-copy-delete-pages-pdf-insert.csusing 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);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?
:path=/static-assets/pdf/content-code-examples/how-to/add-copy-delete-pages-pdf-copy.csusing 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 });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.
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?
:path=/static-assets/pdf/content-code-examples/how-to/add-copy-delete-pages-pdf-delete.csusing 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 });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 an existing PDF document in C#?
IronPDF provides two main methods to add pages: the `Merge` method for appending entire PDFs together, and the `InsertPdf` method for inserting pages at specific positions. Both methods maintain formatting, fonts, and layouts using IronPDF's Chrome rendering engine.
What's the simplest way to combine multiple PDF documents?
The simplest approach is using IronPDF's `Merge` method, which accepts multiple PDF documents as parameters. You can combine numerous PDFs in a single operation, making it ideal for assembling reports from various sources or creating documentation packages.
How do I insert PDF pages at a specific position rather than appending them?
Use IronPDF's `InsertPdf` method to insert pages at any index position. This method provides precise control over page placement, allowing you to specify exactly where in the document the new pages should be inserted.
Can I copy specific pages within a PDF document?
Yes, IronPDF offers `CopyPage` and `CopyPages` methods to duplicate pages within a PDF. These methods allow you to copy individual pages or multiple pages at once while maintaining all formatting and content integrity.
How do I remove unwanted pages from a PDF?
IronPDF provides `RemovePage` and `RemovePages` methods to delete unwanted pages from your PDF documents. You can remove single pages or multiple pages in one operation.
Does page manipulation preserve the original PDF formatting?
Yes, IronPDF's Chrome rendering engine maintains all formatting, fonts, and layouts during page manipulation operations. The engine provides pixel-perfect rendering that preserves document integrity throughout the process.
What platforms support these PDF page manipulation features?
IronPDF supports PDF page manipulation on Windows, Linux, and Mac platforms, making it a versatile solution for cross-platform C# applications.
Is it possible to manage PDF pages with minimal code?
Yes, IronPDF enables page management with minimal code. For example, you can append a PDF to another with just one line: `PdfDocument.FromFile("/input/path.pdf").AppendPdf(PdfDocument.FromFile("/additional/path.pdf")).SaveAs("/output/path.pdf");`






