2

サイズが 595x842px の画像があり、その画像を PDF のページの背景として使用したいと考えています。背景全体を埋めたいです。どうやってやるの?私は今これを持っています:

<?php

error_reporting(E_ALL);

set_include_path(get_include_path() . PATH_SEPARATOR . 'd:/data/o');

// Load Zend_Pdf class 
include 'Zend/Pdf.php';

// Create new PDF 
$pdf = new Zend_Pdf(); 

// Add new page to the document 
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;

// Load image 
$image = Zend_Pdf_Image::imageWithPath('bg.jpg'); 

// Draw image 
$page->drawImage($image, 0, 0, 842, 595);

// Save document as a new file or rewrite existing document 
$pdf->save('test.pdf');




echo 1;

?>

しかし、結果のpdfはひどいもので、背景画像は非常にぼやけており、背景全体を埋めていません。

4

1 に答える 1

2

解決済み:

$page->drawImage($image, 0, 0, 595, 842);

私は本当にばかだ :P

ぼやけた画像の問題は、より解像度の高い画像を作成することで解決されました。

于 2010-06-17T16:36:02.563 に答える