Customize your PDFs by incorporating headers and footers using the headerTemplate and footerTemplate options available for PDFs. See PDF options for all available options.

Example

It is recommended to specify a font and color for your header/footer, the default is white and small.

We are adding a margin to prevent the header from overlapping the PDFs content.

import Doczilla from '@doczilla/node'

const doczilla = new Doczilla('<your token>')

const pdf = await doczilla.pdf.direct({
  page: {
    html: '<div>Your first Doczilla PDF</div>'
  },
  pdf: {
    displayHeaderFooter: true,
    headerHtml: '<div style="font-size: 16px; color: black; padding: 20px">Header</div>',
    footerHtml: '<div style="font-size: 16px; color: black; padding: 20px">Footer - <span class="pageNumber"></span>/<span class="totalPages"></span></div>',

    margin: {
      top: '75px'
    }
  }
})

Output