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 works in the two supported header and footer options which include, HtmlHeaderFooter and TextHeaderFooter. It is quite easy to handle on either.

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:

<div style="page-break-after:always;"></div>