Issues

ZF-3701: impossible to extend PDF classes

Description

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.

Comments

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

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

Changing issues in preparation for the 1.7.0 release.