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 a pages 2 & 3. Similar syntax to to Substring
pdf.RemovePages(1, 2);
pdf.SaveAs("Page1And4.pdf");
Imports IronPdf
' 4-Paged HTML Document example:
Private 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>"
Private renderer = New ChromePdfRenderer()
Private pdf = renderer.RenderHtmlAsPdf(html)
' Remove a pages 2 & 3. Similar syntax to to Substring
pdf.RemovePages(1, 2)
pdf.SaveAs("Page1And4.pdf")
Load or create a multi-page PDF as an IronPdf.PdfDocument object.
Use PdfDocument.RemovePages or PdfDocument.RemovePage to copy pages or page ranges from one PDF into another.
Add Headers and Footers **after** the PDFs are joined using `PdfDocument.AddHeaders` and `PdfDocument.AddFooters` methods... which is a really popular feature!
Related Docs Links
Ready to get started? Version: 2024.12 just released