ZF-3701: impossible to extend PDF classes

Issue Type: Bug Created: 2008-07-21T08:02:43.000+0000 Last Updated: 2008-11-13T14:09:59.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Martijn Korse (themarty) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Pdf

Related issues: Attachments:


Due to the many private variables in the Zend_Pdf classes, it is not possible to extend these classes.

For example, if i wanted to use an extended version of the Zend_Pdf_Page class, i would have to extend Zend_Pdf too, since the $page object is created from within this class. However, for this operation the private $this->_objFactory variable is needed. Dead end. Suppose we solve this problem and we succesfully overload the newPage() method with our own extended version of Zend_Pdf() (so it creates a page object of the extended Zend_Pdf_Page class) and now we want to overload the drawText() method to make it more flexibel. Again, we bump into all sorts of private variables like $this->_font and, worse, $this->_contents! Since $this->_contents doesn't have a getter or a setter it is impossible to ever extend the Zend_Pdf_Page class, because you won't be able to add content. So, more dead ends. There are even private methods like _addProcSet() that you won't be able to use.


Posted by Michal Vrchota (techi) on 2008-08-05T16:29:46.000+0000

This is very serious problem which downgrade OOP principes. In OOP world a single document like booking voucher should be extended from PDF class.

Make this class final or better fix it please

Posted by Benjamin Eberlei (beberlei) on 2008-11-07T05:02:27.000+0000

Fixed in trunk for all Zend_Pdf and Zend_Pdf_Page properties and methods that have been private and now are protected.

Posted by Wil Sinclair (wil) on 2008-11-13T14:09:59.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.