mpdf import all pages from another pdf document

后端 未结 2 2021
[愿得一人]
[愿得一人] 2021-02-20 18:36

I want to be able to append an entire pdf document in the document I am creating with mpdf.

I can import one page using the following code:

$mpdf->Set         


        
2条回答
  •  半阙折子戏
    2021-02-20 19:05

    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();
    

提交回复
热议问题