123456789qwerqwe
123456789qwerqwe

Reputation: 23

mPDF footer showing only on last page


I have a problem with mPDF footer generating. I am using mPDF with nette framework

<sethtmlpageheader name="default_head" value="1" page="ALL" show-this-page="1" />
    {include #content}
<sethtmlpagefooter name="default_foot" value="1" page="ALL" />

Where #content is one or more a tables. Header is on every page, but footer is still only on the last page, no matter how many pages the document has. Anyone has any idea what i might be doing wrong or forgeting?

Thank you for advice in advance

Upvotes: 1

Views: 4744

Answers (1)

Himanshu Saxena
Himanshu Saxena

Reputation: 360

I have got one more solution by which you can add a content only on last page of mPDF. Please follow below steps

  • Add header
  • Add footer
  • Write your HTML
  • Add Footer again (this will be only displayed on last page)
  • Output
    $header = "Page header for all"; // Will be shown on all pages
    $footer = "Page footer for all"; // Will be shown on all pages
    $lastPageFooter = "Add New text for last page footer".$footer; // Adding new text

    $mpdf->SetHTMLHeader($header);
    $mpdf->SetHTMLFooter($footer);
    $html = $patientDetails . '' . $reportContent;
    $mpdf->WriteHTML($html);
    $mpdf->SetHTMLFooter(lastPageFooter);   // This will display footer for last page
    $mpdf->Output();

Hope it helps

Upvotes: 3

Related Questions