mpdf import all pages from another pdf document
In the example the index in "$pdf->ImportPage($i)" is missing.
$pdf->SetImportUse();
$pagecount = $pdf->SetSourceFile([LOCAL_FILEPATH]);
for ($i=1; $i<=($pagecount); $i++) {
$pdf->AddPage();
$import_page = $pdf->ImportPage($i);
$pdf->UseTemplate($import_page);
}
Use page count you get form setting source file in a loop (like below)
$pdf = new mPDF();
$pdf->SetImportUse();
$pagecount = $pdf->SetSourceFile($dashboard_pdf_file);
for ($i=1; $i<=$pagecount; $i++) {
$import_page = $pdf->ImportPage();
$pdf->UseTemplate($import_page);
if ($i < $pagecount)
$pdf->AddPage();
}
$pdf->Output();