Loop in creating mutliple PDF in DOMPDF
<p>I want to loop my PDF content in this, currently I'm using DOMPDF for creating PDF. While looping the PDF content, I did not any pdf content. If I remove the loop, I'm getting the pdf. Actually, I want a PDF which contains 5 pages.</p>

<p>Can anyone help me? Thanks in Advance.</p>

<pre><code>&lt;?php
include('config/config.php');
require_once('dompdf_config.inc.php');
error_reporting(0);
for ($i = 0; $i &lt;= 5; $i++) {
    //here is my content to loop
    $pdf_content = '&lt;body&gt;
                &lt;table width="450" border="0" cellpadding="5" class="table_data"&gt;
                  &lt;tr&gt;
                    &lt;td class="left_col"&gt;3. Chassis No&lt;/td&gt;
                    &lt;td&gt;&lt;b&gt;: ' . $chass_no . '    &lt;/b&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td class="left_col"&gt;4. Engine No.  &lt;/td&gt;
                    &lt;td&gt;    &lt;b&gt; : ' . $engine_id . '        &lt;/b&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                 &lt;/table&gt;
                &lt;/body&gt;
                ';
    //create pdf function
    function createPDF($pdf_userid, $pdf_content, $pdf_For, $filename)
    {
        $path   = 'UsersActivityReports/';
        $dompdf = new DOMPDF();
        $dompdf-&gt;load_html($pdf_content);
        $dompdf-&gt;render();
        $output = $dompdf-&gt;output();
        file_put_contents($path . $filename, $output);
        file_get_contents('output1.php');

        return $filename;
    }

    $name      = date("d-m-y") . rand() . '.pdf';
    $reportPDF = createPDF(12, $pdf_content, 'activity_Report', $name);
}
//loop ends here
?&gt;
&lt;iframe class="prv_pdf" src="/UsersActivityReports/&lt;?php echo $name ?&gt;#zoom=50" height="300px" width="440px"&gt;
</code></pre>