0
我正在使用FPDI加載PDF文件並嘗試在模板內放置PNG圖像。原始文件單位爲毫米和150ppi。當我將圖像設置在座標50毫米,50毫米(50毫米= 141,7323像素)時,圖像實際上設置爲10px更多右邊和10px更多底部151,7323px。我將邊際設置爲0.我將XY原點設置爲0,0。我不知道出了什麼問題。FPDF座標不適合
// initiate FPDI
$pdf = new FPDI('L','mm');
// get the page count
$pageCount = $pdf->setSourceFile('../lib/handoutv1.pdf');
// iterate through all pages
// import a page
$templateId = $pdf->importPage(1);
// get the size of the imported page
$size = $pdf->getTemplateSize($templateId);
// create a page (landscape or portrait depending on the imported page size)
if ($size['w'] > $size['h']) {
$pdf->AddPage('L', array($size['w'], $size['h']));
} else {
$pdf->AddPage('P', array($size['w'], $size['h']));
}
// use the imported page
$pdf->useTemplate($templateId);
$pdf->SetMargins(0, 0, 0);
$pdf->SetFont('Helvetica');
$pdf->SetXY(5, 5);
$pdf->Write(8, 'A complete document imported with FPDI');
$pdf->SetXY(0, 0);
$pdf->Image('http://server.com/png.png',50,50,30,30,'PNG');
我打賭'$ pdf-> SetAutoPageBreak(false);'超過邊距,以免爲我修復它。正如你可以看到他已經設定利潤率:-) – erm3nda