0

I'm trying to render the pages of a pdf file with FPDI, one pdf each.

However, this happens quite slowly. Code sample is below.

The problem is constantly $pdf->setSourceFile($pdf_file); I think it's because of the use?

I need ideas on this.


use setasign\Fpdi\Fpdi;
use setasign\Fpdi\PdfReader;

$pdf_file = 'example.pdf';
$total_page = 2700;
for ($x = 1; $x <= $total_page; $x++)
{
    $pdf = new FPDI();
    $pdf->setSourceFile($pdf_file);
    $templateID = $pdf->importPage($x);
    $pdf->getTemplateSize($templateID);
    $pdf->addPage();
    $pdf->useTemplate($templateID);
    $pdf->Output($x.".pdf", "F");
}


Perfection
  • 39
  • 1
  • 4

0 Answers0