Как получить точный измененный PDF-файл с помощью 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");
?>

Но когда Я получаю измененный PDF-файл. Я могу получить очень искаженный измененный PDF-файл ... чей снимок экрана приведен ниже:

enter image description here

Исходный документ приведен ниже:

enter image description here

Следовательно, может ли кто-нибудь помочь мне получить правильный измененный PDF-файл, используя тот же код / ​​измененный код ..?

7
задан hakre 22 December 2012 в 04:21
поделиться