Jump to content

Importing image in pdf using zend framework


jitu_coder

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;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.