Search code examples
phphtmlmpdf

Page footer centering using MPDF


I have this pdf: enter image description here

How can I make the page numbering centered instead of right alignment? This is how I added the page numbering:

   include("mpdf60/mpdf.php");

   $mpdf=new \mPDF('c','A4','','' , 0, 0, 0, 0, 0, 0);

   $mpdf->setFooter('{PAGENO} of {nbpg}');
 $mpdf->WriteHTML($body);

       $mpdf->Output('Packing Slip.pdf','I');

How can I make it center? its the 'setFooter' ? Im am using mpdf.


Solution

  • you can try the following:

    $mpdf->setFooter('|{PAGENO} of {nbpg}|');
    

    This will center align the page numbers. Any thing on the left of first | will be left aligned and anything on the right of second | will be right alligned.