0
I’d like some help with the mPDF
. I am trying to set up a footer always on the last page and I would like to know if this is possible. Files may contain 1, 2 or more pages, but I need the footer to appear only on the last page.
0
I’d like some help with the mPDF
. I am trying to set up a footer always on the last page and I would like to know if this is possible. Files may contain 1, 2 or more pages, but I need the footer to appear only on the last page.
0
It is enough to instantiate the method SetHTMLFooter()
afterward of WriteHTML()
, as in the code below:
<?php
require_once '/usr/share/php/mpdf/mpdf-5.7.4a/mpdf.php';
$mpdf = new \Mpdf();
$html = '<table class="table-body">';
for ($i = 1; $i <= 100; $i++) {
$html.='<tr>
<td width="30.3%">Forbrug '.$i.'</td>
<td width="23.1%">Periode '.$i.'</td>
<td width="10.76%">'.$i.' MB</td>
<td width="9.28%">Val '.$i.'</td>
<td width="12.9%" align="right">I alt '.$i.'</td>
<td width="13.3%" align="right"><b>moms</b> '.$i.'</td>
</tr>';
}
$html.= '</table>';$mpdf->SetDisplayMode('fullpage');
$footer = "<table width=\"1000\" border=\"1\">
<tr>
<td style='font-size: 18px; padding-bottom: 20px;' align=\"right\">{PAGENO}</td>
</tr>
</table>";
$mpdf->WriteHTML($html);
$mpdf->SetHTMLFooter($footer); /* Aplicando o rodapé apenas na última página */
$mpdf->Output();
If SetHTMLFooter()
turn up before of WriteHTML()
, the footer will be applied to all pages of the document.
In the example, I used the version 5.7.4a
.
Browser other questions tagged php mpdf
You are not signed in. Login or sign up in order to post.