[英]How to get the exact modified PDF using FPDF/FPDI?
我有一個任務是修改PDF並在其中添加一個圖像,我已經使用了FPDF和FPDI庫..其動作代碼如下:
<?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");
?>
但是當我得到Modified pdf時,我可以得到非常扭曲的修改pdf ...其屏幕截圖如下:
原始文件如下:
因此,任何人都可以幫助我使用相同的代碼/修改代碼檢索正確的修改PDF ..?
它的fpdf_tpl.php文件需要通過新下載進行更新
http://www.tcpdf.org/使用TCPDF很好......
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.