How to get the exact modified PDF file using FPDF / FPDI?

I have a task to change the PDF and add an image to it, for which I used the FPDF and FPDI libraries .. whose action code is given below:

<?php require_once('fpdf.php'); require_once('fpdi.php'); $pdf =& new FPDI(); $pdf->AddPage(); //Set the source PDF file $pagecount = $pdf->setSourceFile("Completed.pdf"); //Import the first page of the file $tpl = $pdf->importPage(1); //Use this page as template // use the imported page and place it at point 20,30 with a width of 170 mm $pdf->useTemplate($tpl, 20, 30, 170); #Print Hello World at the bottom of the page //Select Arial italic 8 $pdf->SetFont('Arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(90, 160); //$pdf->Rotate(90); $pdf->Image('think.jpg',120,240,20,20); $pdf->Image('think.jpg',120,260,20,20); //$pdf->Write(0, "Hello World"); $pdf->Output("modified_pdf.pdf", "F"); ?> 

But when I get Modified pdf, I can get a very distorted modified pdf ... whose screenshot is below:

enter image description here

The original document is below:

enter image description here

Therefore, can someone help me in getting the correct modified PDF code using the same code / modified code ..?

+6
php pdf fpdf fpdi
source share
2 answers

its fpdf_tpl.php file needs to be updated with a new download

+2
source share

http://www.tcpdf.org/ Using TCPDF is good ...

0
source share

All Articles