Generate PDFs with Headers and Footers on Linux Using PSPDFKit Processor 2021.3
We’re pleased to announce that PSPDFKit Processor 2021.3 is out. The main feature of this release is a new API for declaring custom headers and footers as part of the HTML when using the PDF Generation API.
Headers and Footers
You can now define custom headers and footers in your HTML templates used for PDF generation. These header and footer elements will be repeated across all generated pages. You could use a custom header or footer, for example, to add custom branding to an entire generated PDF.
To define a header or footer, you need to add a container element with an ID — pspdfkit-header
or pspdfkit-footer
, respectively. You can use any HTML and CSS inside your header and footer containers, which enables you to add images, use custom fonts, set the background, and more.
It’s also possible to display the current page number and page count in your headers or footers using placeholders we provide. This is as simple as including the following:
<p> Page {{ pageNumber }} of <strong>{{ pageCount }}</strong> </p>
Please refer to our headers and footers guide to learn more about this new feature.
Other Improvements and Fixes
This release also ships with a bunch of other improvements and bug fixes. The most notable ones are:
-
Adds the
ALLOW_REMOTE_ASSETS_IN_GENERATION
configuration option that allows you to control whether external resources — such as remote fonts, CSS, or images — can be used when performing PDF Generation. -
Fixes HTML generation for HTML templates that contained invisible form fields or form fields with duplicated IDs.
-
Fixes incorrect attachment handling when watermarking, which prevented using an image annotation as a watermark.
For a complete list of changes, see the PSPDFKit Processor 2021.3 changelog and the migration guide.