Interface HtmlAffix

An HTML Header or Footer which will be printed onto every page of the PDF. This can be used to override

When using HtmlHeaderFooter it is important to set htmlFragment

Merge meta-data into your HTML using any of these placeholder strings: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}


  • HtmlAffix


dividerLine?: boolean

Adds a horizontal line divider between the header / footer and the page content on every page of the PDF document.



dividerLineColor?: string

A html color code for divider line color see dividerLine



htmlFragment: string

The HTML which will be used to render the Header or Footer should be an HTML snippet rather than a complete document. It may contain styles & images.

Merge meta-data into the HtmlFragment by putting any of these placeholder strings into the text: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}. An alternative mail-merge style using the pattern is also supported.

HtmlFragment is a stand-alone HTML document which does not inherit styles or settings from your main HTML content unless LoadStylesAndCSSFromMainHtmlDocument is set to true.

loadStylesAndCSSFromMainHtmlDocument?: boolean

Loads style code blocks and links to CSS style sheets from the main HTML document (which provides the PDF content) into the HtmlAffix.

By default, Html Headers and Footers are stand-alone HTML documents with their own default styles. Setting loadStylesAndCSSFromMainHtmlDocument to true will attempt to load all STYLE and LINK tags from the main HTML document (which renders the PDF) into the HtmlHeaderFooter.

If your main HTML document contains complex CSS frameworks, styles the HEAD or BODY element heavily, or loads CSS from JavaScript, then this method may not work as intended.

This feature is not available for RenderUrlAsPdf methods. It works for HTMLToPdf and HtmlFileToPdf conversions only.

It is often preferable to load style sheets explicitly into your HTML Headers and Footers as STYLE and LINK tags within the htmlFragment for granular control.



maxHeight?: number

Maximum Height of the HTML Header / Footer in millimeters. This value must be set sufficiently high to display the full HTML header / footer content.

Generated using TypeDoc