I am using mPDF to write some dynamic text in my pdf. This is my code:
<?php
function setpageNo($page){
$page+=1;
$mpdf->SetFooter("Page: ".$page);
}
foreach($arr as $x){
mpdf.WriteHTML('<div style="text-align:center;">'.$x.'</div>');
}
?>
The thing is the text $x is of dynamic length, i.e., it can be as big as a paragraph or as small as one line. So is there a way to enable automatic page breaking and call setPageNo() function as soon as the text reaches the footer?