Headers and Footers

Headers and Footers can be tricky in mPDF. Please read the docs here: https://mpdf.github.io/headers-footers/headers-footers.html

/** @var RockPdf $pdf */
$pdf = $modules->get('RockPdf');
  ->save(preview: true);

This is a simple example that can help you get started quickly:

  @page {
    footer: html_footer;
    header: html_header;
    margin-header: 10mm;
    margin-top: 35mm;
    margin-footer: 0mm;

   * use negative margins to move coloured footer
   * to the very side of the document
  .footer {
    margin-left: -15mm;
    margin-right: -15mm;
<htmlpageheader name="header">
  <table class="w-full">
      <td class="f15 text-bold border">
        Your Logo
      <td class="text-right f10 border">
        Your Address<br>
        Some Road 123<br>
        Some City

Page 1
<pagebreak />
Page 2

<htmlpagefooter name="footer">
  <div class="footer section bg-muted py10 px15">
    <table class="w-full f8">
        <td class="text-left w50">
          PDF created with RockPdf
        <td class="text-center">
          Your Logo
        <td class="text-right w50">
          <span>Page {PAGENO}/{nb}</span>
RockPdf - Headers and Footers