function mergePdf($pdfArr){ $pdf = new Mpdf(); foreach($pdfArr as $currentPdf){ $pagecount = $pdf->SetSourceFile($currentPdf); for($i = 1; $i <= $pagecount; $i++){ $pdf->AddPage(); $tplId = $pdf->importPage($i); $pdf->useTemplate($tplId); } } //direct show on browser $pdf->Output(); //spacefic location save file $outputpath = 'location/output.pdf'; $pdf->Output($outputpath, 'F'); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter