Header Footer Template Type

The header and footer template is used for PDF documents only, and this parameter does not work with image documents. It allows you to specify a Header or Footer to use on the PDF.

Header & Footer Template

Each template type headerTemplate and footerTemplate are identical from a configuration standpoint. However, each will be different due to how Chrome treats them, so you will need to experiment with each one to find what works best for your scenario.

Methods & Styling

All of the standard Chrome header and footer templating mechanisms are supported. To use the standard ones, you would set your method to 'text' and then pass in the template with the appropriate classes as a string into the template field.

We have also augmented the built-in support and added a new method called 'extract'. Using this method, you would specify a 'selector', which would identify an element in your HTML. It would then extract this element out of the DOM, and convert it into a format that Chrome will accept for headers. This method also will accept a single image embedded in the header or footer. Our service will handle converting this image to the appropriate format and embedding it to work correctly.

Suppose you are using the 'extract' method. In that case, we also support applying any valid CSS Style to the header/footer container using the 'style' property. Additionally, if you have embedded an image, you can style the image using the 'imageStyle' property.

Type Definitions

headerTemplate
(headerFooterTemplate)
margin
(margin)
Margin for the Header
style
(CssStyle)
CSS Style for the header outer container.
imageStyle
(CssStyle)
CSS Style for the image inside the header container.
method
(string)

Type of header template.

text
(string)
Use the default text template method.
extract
(string)
Extracts the header from the HTML.
selector
(string)
The selector to use to find the header container in the HTML.
template
(string)
The template string if using template type of text.
footerTemplate
(headerFooterTemplate)
margin
(margin)
Margin for the Header
style
(CssStyle)
CSS Style for the header outer container.
imageStyle
(CssStyle)
CSS Style for the image inside the header container.
method
(string)

Type of header template.

text
(string)
Use the default text template method.
extract
(string)
Extracts the header from the HTML.
selector
(string)
The selector to use to find the header container in the HTML.
template
(string)
The template string if using template type of text.