Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCPDF go to page

Tags:

php

tcpdf

Is their a way that I can go back to a previous page after calling addPage more than once because when I call write it adds it to the current page where I need it to write on the first page. I have been through its documentation and cannot seem to find anything?

By the way I am creating my pdf in php

Thanks

like image 433
Ian Avatar asked Sep 17 '25 03:09

Ian


2 Answers

This was solved using the following code,

$numPages = $fpdi2->getNumPages();

for($int=1;$int < $numPages + 1; $int++){
    $fpdi2->setPage($int );
    // do your code here with that page
}
like image 63
Ian Avatar answered Sep 19 '25 20:09

Ian


You have to change your program logic.

like image 30
powtac Avatar answered Sep 19 '25 18:09

powtac