2
我有一张图像,尺寸为595x842px,我想将该图像用作pdf中页面的背景。我想要它填充整个背景。我怎样才能做到这一点?我有现在这样:Zend_Pdf如何设置595x842图像作为A4的背景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 terrbile,背景图像非常模糊和不填充整个背景。
如果pdf包含现有内容并且您只是想添加背景,该怎么办? – Wouter 2017-03-04 11:53:28