IRONSOFTWAREHOME
Page Numbers and Page Breaks
using IronPdf;

var 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>";

// Instantiate Renderer
var renderer = new ChromePdfRenderer
{
    RenderingOptions =
    {
        HtmlFooter = new HtmlHeaderFooter()
        {

            MaxHeight = 15, // millimeters
            HtmlFragment = "<center><i>{page} of {total-pages}<i></center>",
            DrawDividerLine = true
        }
    }
};

var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("pageNumber.pdf");
Imports IronPdf

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

' Instantiate Renderer
Dim renderer = New ChromePdfRenderer With {
    .RenderingOptions = New ChromePdfRenderOptions() With {
        .HtmlFooter = New HtmlHeaderFooter() With {
            .MaxHeight = 15, ' millimeters
            .HtmlFragment = "<center><i>{page} of {total-pages}<i></center>",
            .DrawDividerLine = True
        }
    }
}

Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("pageNumber.pdf")
NuGet Download
PM > Install-Package IronPdf
Page Numbers and Page Breaks

Page Numbers and Page Breaks

IronPDF's flexibility when it comes to editing and rendering headers and footers to the developer's taste and functionality is unmatched. This feature allows us to merge more information about page numbering into the header or footer.

In this example, we will show you how to deal with page numbers and page breaks in IronPDF.

This operates within the two supported header and footer options, which include HtmlHeaderFooter and TextHeaderFooter. It is quite easy to handle either option.

The class TextHeaderFooter defines PDF header and footer display options and uses a logical approach to rendering headers and footers for the most common use cases. You can set page numbers to display on the right, center, or left of the header or footer and also adjust the font type and size to make it consistent with the rest of your PDF body text.

To create a page break in HTML to PDF in .NET, you can use the HTML snippet:

For more details on how to use these features effectively, visit the IronPDF Documentation for Headers and Footers on the official website.

Learn to manage HTML to PDF page breaks with IronPDF.
View on GitHub

Ready to Get Started?

Nuget Downloads 21,105,021Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
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 Iron Suite
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
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999