PHP合併PDF

php冉發表於2024-06-12

composer安裝元件 兩個都要安裝!
composer require setasign/fpdi
composer require setasign/fpdf

點選檢視程式碼
        $pdf = new Fpdi();
        $page_count1 = $pdf->setSourceFile("./68/TQ02·43072110000100/0104/68-TQ02·43072110000100-0104·01.pdf");
        for ($i = 1; $i <= $page_count1; $i++) {
            $page_id = $pdf->importPage($i);
            $size = $pdf->getTemplateSize($page_id);
            $pdf->AddPage($size['orientation'], $size);
            $pdf->useImportedPage($page_id);
        }
        $pdf->Output('F', './68/TQ02·43072110000100/0104/68-TQ02·43072110000100-0104.pdf');

相關文章