Add HTML Headers & Footers

The HTML headers and footers are rendered as independent HTML documents which may have their own assets and stylesheets. It gives developers total control over how their headers and footers look. The height of the rendered headers or footers can be controlled to match their content exactly.

In this example, we show how to add HTML headers and footers to your PDF documents in IronPDF.

HTML headers or footers will be printed onto every page of the PDF when you add them to your project. This can be used to override classic headers and footers.

When using HtmlHeaderFooter, it is important to set HtmlFragment, which will be used to render the headers or footers. It should be an HTML snippet rather than a complete document. It may also contain styles & images.

You can also merge meta-data into your HTML using any of these placeholder strings such as {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}.