john
john

Reputation: 157

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.

Upvotes: 3

Views: 7145

Answers (2)

Ju Oliveira
Ju Oliveira

Reputation: 428

You can set an HTML Footer and give the proper format:

$mpdf->SetHTMLFooter('<div style="text-align: center">{PAGENO} of {nbpg}</div>');

SetHTMLFooter() Function

Upvotes: 6

mega6382
mega6382

Reputation: 9396

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.

Upvotes: 6

Related Questions