Split PDF into chunks by page range in Php

后端 未结 2 1073
后悔当初
后悔当初 2021-01-27 06:29

so after browsing through many packages like TCPDF, FPDP, DOM2PDF and many other excellent php pdf packages, I couldn\'t find this feature in any packages where it allows to spl

2条回答
  •  猫巷女王i
    2021-01-27 07:13

    You can do this with the combination of FPDI and FPDF.

    $new_pdf = new setasign\Fpdi\FPDI();
            
    for($i = 20; $i <= 200; $i++){
        $new_pdf->AddPage();
        $new_pdf->setSourceFile("source.pdf");
        $new_pdf->useTemplate($new_pdf->importPage($i));
    }
    
    $new_pdf->Output("output.pdf", "F");
    

提交回复
热议问题