muthu_kumar 0 Newbie Poster

1)i have tennacy contract pdf.. its contain 3 pages
2)i want to append the data in the tennacy contract page
3) whether is is possibe in fpdf..

# here my code#

<?php
require_once('fpdf.php');
require_once('fpdi.php');
// Original file with multiple pages 
$fullPathToFile = "2.pdf";

class PDF extends FPDI
{
    var $_tplIdx;
    function Header()
    {

        global $fullPathToFile;

        if (is_null($this->_tplIdx)) {

            // THIS IS WHERE YOU GET THE NUMBER OF PAGES
            $this->numPages = $this->setSourceFile($fullPathToFile);
            $this->_tplIdx  = $this->importPage(1);

        }
        $this->useTemplate($this->_tplIdx, 0, 0, 200);

    }

    function Footer()
    {


    }
}

// initiate PDF
$pdf = new PDF();
// add a page
$pdf->AddPage();
// The new content
            $pdf->SetFont('Arial', '', 8);
            $pdf->SetTextColor(0, 0, 0);
            $pdf->SetXY(44,78);
            $pdf->Write(0,'home');
            $pdf->SetXY(44,85);
            $pdf->Write(0,'BO : 787878');
            $pdf->SetXY(44,91);
            $pdf->Write(0,'ORN 898988');
            $pdf->SetXY(128,91);
            $pdf->Write(0,'+97 9500201487');
            $pdf->SetXY(44,98);
            $pdf->Write(0,'97 8001551619');
            $pdf->SetXY(128,98);
            $pdf->Write(0,'8001551619');
            $pdf->SetXY(44,105);
            $pdf->Write(0,'Local Address');
            $pdf->SetXY(44,112);
            $pdf->Write(0,'Support@home.com');
            $pdf->SetXY(44,118);
            $pdf->Write(0,'John Corner');
            $pdf->SetXY(44,125);
            $pdf->Write(0,'BN 7878');
            $pdf->SetXY(128,125);
            $pdf->Write(0,'985022 200212');
            $pdf->SetXY(44,142);
            $pdf->Write(0,'Willson');
            $pdf->SetXY(44,148);
            $pdf->Write(0,'M 898988');
            $pdf->SetXY(128,148);
            $pdf->Write(0,'Duch');
            $pdf->SetXY(44,155);
            $pdf->Write(0,'PT 9898');
            $pdf->SetXY(128,155);
            $pdf->Write(0,'20-10-2020');
            $pdf->SetXY(44,162);
            $pdf->Write(0,'98 9898 9898');
            $pdf->SetXY(128,162);
            $pdf->Write(0,'PO 356');
            $pdf->SetXY(44,168);
            $pdf->Write(0,'458952455');
            $pdf->SetXY(128,168);
            $pdf->Write(0,'989856565');
            $pdf->SetXY(44,175);
            $pdf->Write(0,'Dummy Address');
            $pdf->SetXY(44,182);
            $pdf->Write(0,'john@home.com');

# here second page code is start  just i set the height and ,move to next page #

            $pdf->SetY(800);
            $pdf->Write(0,'john@home.com');
    // THIS PUTS THE REMAINDER OF THE PAGES IN

if ($pdf->numPages > 1) {
    for ($i = 1; $i <= $pdf->numPages; $i++) {
        //$pdf->endPage();
        $pdf->_tplIdx = $pdf->importPage($i);
       // $pdf->AddPage();
    }
}
//show the PDF in page
//$pdf->Output();
// or Output the file as forced download
$pdf->Output("2.pdf", 'D');
?>