Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get total no of pages in TCPDF?

Tags:

cakephp

tcpdf

I used getNumPages() function to get the total number of pages in tcpdf, but I didn't get the correct output. What should I do to get the correct number?

like image 811
Panky Avatar asked Apr 02 '12 13:04

Panky


1 Answers

Hi I just wanted to add for anyone reading this, that I was using getNumPages() like you in the footer and it was giving me trouble because it was showing me the number of pages inserted up to now. So I was getting 1/1, 2/2, 3/3, etc.

This is what I tried at first:

$this->getPage().'/'.$this->getNumPages()

I looked at example number 3 and used the following instead to get the correct result.

$this->getAliasNumPage().'/'.$this->getAliasNbPages()
like image 170
alexg Avatar answered Nov 04 '22 10:11

alexg