title: Add page break after match of certain class on div with mpdf
body: <p>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.</p>
  
  <p><strong>html</strong></p>
  
  <pre><code> &lt;div class='text my_form' style='margin:0px 0 0 0; padding:0px 0 0 0;  border-style:dotted; border-color:white;'&gt;
  </code></pre>
  
  <p>I'm passing this to the php as $html</p>
  
  <p><strong>PHP</strong></p>
  
  <pre><code> require_once ("./libraries/MPDF57/mpdf.php");
  
      $mpdf=new mPDF("", "Letter", "", "", 10, 10);
  </code></pre>
  
  <p>I want to add a page break after it finds the div shown above </p>
  
  <pre><code> preg_match_all("/((\&lt;div\s)(class='text\smy_form'[\s\w\s]*border-color:white)(.+?)(\&gt;)/", $html, $matches, PREG_SET_ORDER);
  
      foreach($matches as $value) {
         $html= $mpdf-&gt;AddPage();
       }
  
       $mpdf-&gt;WriteHTML($html);
  
       $filename = "documentx.pdf";
  
      $mpdf-&gt;Output($fileName, 'F');
  </code></pre>
  
  <p>However, is not working, please help me go through the right track :)</p>