How to get the total number of pages in MPDF?

2019-04-21 08:04发布

I'm using PHP MPDF to create PDF files. At the footer I'm able to print the current page number using

{PAGENO}

But how do I get the total number of pages in the PDF file? So that in the footer I can print like:

Page (Current Page) of (Total number of pages)   
Page 1 of 6

标签: php pdf mpdf
2条回答
地球回转人心会变
2楼-- · 2019-04-21 08:06

According to the official documentation:

$mpdf=new mPDF();
$mpdf->setFooter("Page {PAGENO} of {nb}");
查看更多
我只想做你的唯一
3楼-- · 2019-04-21 08:30

you can use {nb} it gives you total number of pages in mpdf

查看更多
登录 后发表回答