views:

26

answers:

1

I have an image with 595x842px dimensions, I would like to use the image as a background for a page in pdf. I want it to fill the whole background. How can I do that? I have this now:

<?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;

?>

But the resulting pdf is terrbile, the background images is very blurry and doesn't fill the whole background.

A: 

SOLVED:

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

I'm really dumb :P

The issue with blurred image was solved by making a greater resolution image.

Richard Knop