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

断了今生、忘了曾经 提交于 2019-11-28 00:41:11

问题


i have a task to modify the PDF and add an image into it, for which I Have 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 the Modified pdf I can get very distorted modified pdf... whose screen shot is given below:

The Original Document is as given below:

Hence Could anyone help me in retrieveing the correct Modified PDF using the same code/ modified code..?


回答1:


its fpdf_tpl.php file needed to be updated with new download




回答2:


http://www.tcpdf.org/ Use TCPDF its good ...



来源:https://stackoverflow.com/questions/5256153/how-to-get-the-exact-modified-pdf-using-fpdf-fpdi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!