1
How to make the page number appear in the footer on all pages? I have briefly the code below, but the way it is, the page number only appears on the last page, how to make it appear on all pages?
$mpdf = new mPDF(
'', // mode - default ''
'', // format - A4, for example, default ''
0, // font size - default 0
'', // default font family
15, // margin_left
15, // margin right
58, // margin top
60, // margin bottom
6, // margin header
0, // margin footer
'L'); // L - landscape, P - portrait
$mpdf->SetDisplayMode('fullpage');
$footer = "<table width=\"1000\">
<tr>
<td style='font-size: 18px; padding-bottom: 20px;' align=\"right\">{PAGENO}</td>
</tr>
</table>";
$mpdf->SetHTMLFooter($footer);
$mpdf->Output();
because the style of odd and even pages needs to be different?
– alexandre9865
I edited the answer. It does not change the style (not necessarily). In your question you are using the mode
RUNTIME
to set the footer, and these are the library rules for this mode. Test this code in your environment, @Alexandremartinsmontebelo. It has 4 pages and all are numbered sequentially ;)– ShutUpMagda
got it, qto to RUNTIME mode, where that "Desdeclaro" it? I could not see it comparing the codes.
– alexandre9865
Changing the mode of declaring the variable that defines the footer. See: Ways to declare headers and footers. This one would be the way
NAMED
: Method 4, who usesDefHeaderByName()
. Both the question and the answer are usingRUNTIME HTML
withSetHTMLFooter()
.– ShutUpMagda
Got it, thanks for the tips.
– alexandre9865