I am converting a report (in html)to pdf using mPDF library, but is putting all pages into one. I want to add a page break after a certain but I haven't been successful.
html
<div class='text my_form' style='margin:0px 0 0 0; padding:0px 0 0 0; border-style:dotted; border-color:white;'>
I'm passing this to the php as $html
PHP
require_once ("./libraries/MPDF57/mpdf.php");
$mpdf=new mPDF("", "Letter", "", "", 10, 10);
I want to add a page break after it finds the div shown above
preg_match_all("/((\<div\s)(class='text\smy_form'[\s\w\s]*border-color:white)(.+?)(\>)/", $html, $matches, PREG_SET_ORDER);
foreach($matches as $value) {
$html= $mpdf->AddPage();
}
$mpdf->WriteHTML($html);
$filename = "documentx.pdf";
$mpdf->Output($fileName, 'F');
However, is not working, please help me go through the right track :)
I use this code before closing the foreach tag: $html .= "<pagebreak />";
foreach($matches as $value) {
$html .= "<pagebreak />";
}