FPDF TCPDF AJAX HTML Javascript jQuery PHP Example MORE
Need a Website Or Web Application Contact : +91 9437911966 (Whatsapp) Note: Paid Service

How to add multiple pages pdf in FPDF using FPDI


<?php
require_once('prog/fpdf.php');
require_once('prog/fpdi.php');

/* initiate FPDI */
$pdf = new FPDI();

/* set the source file */
$pageCount = $pdf->setSourceFile("apps/Par.pdf");

for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
    $tplIdx = $pdf->importPage($pageNo);

    /* add a page */
    $pdf->AddPage();
    $pdf->useTemplate($tplIdx, null, null, 0, 0, true);

    /* font and color selection */
    $pdf->SetFont('Helvetica');
    $pdf->SetTextColor(200, 0, 0);

    /* now write some text above the imported page */
    $pdf->SetXY(40, 83);
    $pdf->Write(2, 'THIS IS JUST A TEST');
}

$pdf->Output();