mpdf import all pages from another pdf document

后端 未结 2 2031
[愿得一人]
[愿得一人] 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:23

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

提交回复
热议问题