Amritpal singh
Amritpal singh

Reputation: 865

Creating PDF with Zend Framework

I am using Zend Framework and inherited classes i.e. My_Pdf (that i got from sourceforge and My_Pdf library is used to draw tables)to create PDF file from database. When I create PDF file without table outlines it is working well and generating PDF. But when i try to draw table corresponding to data, I got an error,

Fatal error: Declaration of My_Pdf_Page::drawImage() must be compatible with that of  Zend_Pdf_Canvas_Interface::drawImage() in C:\Users\TranceServe\Zend\workspaces\DefaultWorkspace7\Crushed_PLanet\library\My\Pdf\Page.php on line 369

Please guide me what to do.

Upvotes: 3

Views: 1090

Answers (2)

Ian
Ian

Reputation: 46

I came across this problem myself. I've not tested in 1.11.3, but in 1.11.0. All you have to do is change your method drawImage in My_Pdf_Page is specify the argument $image as being of object type 'Zend_Pdf_Resource_Image':

public function drawImage( Zend_Pdf_Resource_Image $image,$x1,$y1,$width,$height,$inContentArea=true){

Upvotes: 3

markus
markus

Reputation: 40685

This means that the blueprint of a deriving class is not identical to a class higher up in the inheritance hiearchy.

And this most probably means that the PDF library has not been updated to work with the latest Zend Framework version.

You are using Zend Framework version 1.11.3 BUT...

Very obviously the library you are trying to use was written for Zend Framework 1.8 (first box), it has not been updated since May 2009 (second box) and therefore nobody downloads it anymore these days (third box).

Lesson: Know your tools!

Upvotes: 5

Related Questions