Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove header footer only for the first page - mpdf

Tags:

mpdf

Below two functions in the Mpdf adding the header and footer in all the pages.

SetHTMLHeader() SetHTMLFooter()

But, anyone please help me to remove the header and footer from the first page of the pdf?

like image 640
agurchand Avatar asked Sep 03 '25 17:09

agurchand


2 Answers

Here is a hack that works. Wrap your header/footer html in div with class with page number derived class like "page_{PAGENO}"

<div class='hide_first page_{PAGENO}'>{$header_html}</div>

Then have the following css

div.hide_first.page_1 {
  display : none;
}
div.hide_first {
  display : block;
}
like image 135
james funk Avatar answered Sep 07 '25 19:09

james funk


mPDF has an option on this called "show-this-page" : - Setting this to 0 would, i guess, not show it on the first page.

Have a look at the documentation: http://mpdf1.com/manual/index.php?tid=253

like image 32
Christer Avatar answered Sep 07 '25 18:09

Christer