7

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を取得すると、非常に歪んだModified pdfを取得できます...そのスクリーンショットを以下に示します:

ここに画像の説明を入力してください

元のドキュメントは次のとおりです。

ここに画像の説明を入力してください

したがって、誰かが同じコード/変更されたコードを使用して正しい変更されたPDFを取得するのを手伝ってくれるでしょうか..?

4

2 に答える 2

2

そのfpdf_tpl.phpファイルを新しいダウンロードで更新する必要がありました

于 2011-03-10T11:33:08.787 に答える
0

http://www.tcpdf.org/TCPDFを使用してください...

于 2011-03-10T09:37:11.850 に答える