Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend pdf errors with function Image drawing

I want to put image to my pdf file from code function in zend that i get simple example from here http://framework.zend.com/manual/1.12/en/zend.pdf.drawing.html and this is my code

    $image = Zend_Pdf_Image::imageWithPath("' . $base . '/images/logo1.png");
    $page->drawImage($image, 100, 100, 400, 300);
    // add page to document
    $pdf->pages[] = $page;
    $pdf->save("data/reports/-report.pdf");

but i get errors like this

PDF error: Cannot create image resource. File not found.

any help with it. thanks

like image 985
koe Avatar asked Jul 07 '26 22:07

koe


1 Answers

your including single quotes inside a file name.

$image = Zend_Pdf_Image::imageWithPath("' . $base . '/images/logo1.png");

change it so it reads

$image = Zend_Pdf_Image::imageWithPath($base . "/images/logo1.png");
like image 178
DevZer0 Avatar answered Jul 09 '26 10:07

DevZer0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!