php - DOMPDF: how to concatenate more DOMPDF outputs

one text

I'm working around the DOMPDF issue limit about the tables that exceed the page length.

I have a loop and for each step I ask DOMPDF to render one page with a subrange of rows that can stay altogether into the page.

No errors, but when I send the output to the screen (or create the output PDF file) I only see the last step of the loop, with the last subrange of rows...

Here my code:

...
$output = '';
$initrow = 0;
$rowsperpage = 25;
$items_nr = 100; //total nr of rows

while ($initrow < $items_nr) 
{   

    // instantiate and use the dompdf class
    $options = new Options();
    $options->set('enable_html5_parser', true);
    $options->set('isJavascriptEnabled', true);

    $dompdf = new Dompdf($options);

    ob_start();

    $_GET['initrow'] = $initrow;
    $_GET['rowsperpage'] = $rowsperpage;

    //get the html from my php page                 
    require "./mypage.php"; 
    $html = ob_get_clean();
    
    //Create PDF
    $dompdf->loadHtml($html);
    $dompdf->setPaper('A4', "$x_orientation");

    // Render the HTML as PDF
    $dompdf->render();

    $output = $output . $dompdf->output(); 
    
    $initrow = $initrow + $rowsperpage;     
    
}   

// Output the generated PDF to Browser
$dompdf->stream($output, array("Attachment" => false));
exit(0);
...

some idea? thanks to everyone

Source