Footers
Footer
When enabled, the footer is applied to every PDF page. Header-style selective page targeting is not exposed as a separate footer API.
Basic footer
<Html2Pdf
:inject-footer="true"
:footer-height="58"
footer-mode="html"
footer-text="My Company"
footer-template="Page {n} of {total}"
/>
If injectFooter is false, the package does not reserve footer-specific bottom space. Any explicit bottom margin supplied through htmlToPdfOptions.margin remains.
HTML footer
<Html2Pdf
:inject-footer="true"
footer-mode="html"
footer-html="<strong>My Company</strong>"
footer-template="Page {n} of {total}"
/>
When footerHtml is non-empty in HTML mode, it takes precedence over footerText.
footerHtmlis intentionally trusted HTML. Do not pass unsanitized user input.
Text footer
<Html2Pdf
:inject-footer="true"
footer-mode="text"
footer-text="My Company"
footer-template="Page {n} of {total}"
/>
In selectable-text mode, footer text and the page-number template are emitted as selectable PDF text.
Optional footer logo
Footer logos are enabled by default.
<Html2Pdf
:inject-footer="true"
:footer-logo-enabled="false"
footer-mode="text"
footer-text="Text-only footer"
/>
Footer logo sizing
<Html2Pdf
:inject-footer="true"
:footer-logo-enabled="true"
footer-logo-url="/wide-logo.png"
:footer-logo-width="150"
:footer-logo-height="30"
/>
The logo keeps its original aspect ratio.
Default logo box:
26 × 26 CSS pixels
Footer page numbering
Supported placeholders:
{n}
{total}
Example:
Page {n} of {total}
Output:
Page 2 of 5
The footer template is the package's built-in page-numbering mechanism. There is no separate dedicated page-numbering API.
Deprecated footer compatibility
The old prop remains supported:
<Html2Pdf :use-footer-component="true" />
Prefer:
<Html2Pdf footer-mode="html" />
or:
<Html2Pdf footer-mode="text" />
When footerMode is explicitly provided, it takes priority over useFooterComponent.
Footer props
| Prop | Type | Default | Description |
|---|---|---|---|
injectFooter | boolean | false | Enable footer rendering. |
footerHeight | number | 58 | Footer height in the current jsPDF unit. |
footerMode | `'html' \ | 'text'` | compatibility-resolved |
footerText | string | '' | Plain-text footer content / HTML-mode fallback. |
footerHtml | string | '' | Trusted HTML footer content. |
footerTemplate | string | Page {n} of {total} | Page number/footer template. |
footerLogoEnabled | boolean | true | Show/hide footer logo. |
footerLogoUrl | string | '' | Logo URL. |
footerLogoDataUrl | string | '' | Logo data URL/base64. |
footerLogoWidth | number | 26 | Maximum logo width in CSS pixels. |
footerLogoHeight | number | 26 | Maximum logo height in CSS pixels. |
footerBackgroundColor | string | #F8F9FA | Footer background. |
footerTextColor | string | #5F6368 | Footer text/fallback color. |
useFooterComponent | boolean | true | Deprecated compatibility option. |
