IRONSOFTWAREHOME
Remove Specific PDF Pages
using IronPdf;

// 4-Paged HTML Document example:
const string 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>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 4th Page</p>";


var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);

// Remove 2 & 3 pages. Similar syntax to to Substring
pdf.RemovePages(1, 2);

pdf.SaveAs("Page1And4.pdf");
Imports IronPdf

' 4-Paged HTML Document example:
Const html As String = "<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>" &
                       "<div style = 'page-break-after: always;'></div>" &
                       "<p> This is 4th Page</p>"

Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf(html)

' Remove 2 & 3 pages. Similar syntax to to Substring
pdf.RemovePages(1, 2)

pdf.SaveAs("Page1And4.pdf")
NuGet Download
Install-Package IronPdf
Remove Specific PDF Pages

Remove Specific PDF Pages

One method of altering your PDF document's structure is by removing specific pages from within the PDF. This can be used to remove unwanted or unnecessary pages from your PDFs, or to tidy up a PDF by removing blank pages. In IronPDF, this can be done in one simple line of code thanks to the RemovePages method.

For situations where you only need to remove a single page, you would use the RemovePage() method, which removes the page at the specified zero-based index.

Explore how to add, copy, or delete PDF pages with IronPDF.
View on GitHub

Ready to Get Started?

Nuget Downloads 20,389,208Version:2026.8just released

Key in blue circle

Get your free 30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
  • 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 related to IronPDF Product Demo

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