我有一个尺寸为 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 很糟糕,背景图像非常模糊,并没有填满整个背景。