Jump to content

Archived

This topic is now archived and is closed to further replies.

jitu_coder

Importing image in pdf using zend framework

Recommended Posts

First of all its just two days since i started zend and i am on a learning curve so please ignore any silly mistakes i might have made and help me out here guys.

i have an image i want to import into a PDF that have some text. I want to append it to the text and display on web page. Can anyone please tell me what i am doing wrong here ? PDF generated is corrupt. This is my code here :

 

 

$pdf = new Zend_Pdf();

$page = $pdf->newPage('510:745:'); 


// insert picture

$image_name = "test.png";
$image = Zend_Pdf_Image::imageWithPath($image_name); 
$page->drawImage($image, 200, 200, 0, 0);
$pdf->pages[] = $page;
$pdfData = $pdf->render(); 
header("Content-Disposition: inline; filename=result.pdf"); 
header("Content-type: application/x-pdf"); 
echo $pdfData;

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.