ZF-5156: Custom pagesize results in fatal error
Description
I tried to create a PDF with custom size and checked out what format my notation should be. According to the constants and the descriptions I could find i is "x:y" and so I did:
$objPage = new Zend_Pdf_Page('100:100');
this resulted in a fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Wrong pagesize notation.'.
And it goes wrong in this piece of code on line 303 of Zend/Pdf/Page.php :
$pageDim = explode(':', $param1);
if(count($pageDim) == 3) {
$pageWidth = $pageDim[0];
$pageHeight = $pageDim[1];
}
the count is expected to be 3, but this should be 2 ofcourse.
Comments
Posted by R Slootjes (rslootjes) on 2008-12-05T00:55:22.000+0000
A little update
{notation} const SIZE_A4 = '595:842:'; const SIZE_A4_LANDSCAPE = '842:595:'; {notation}
these constants do have the notation "x:y:" instead of the asked "x:y" notation at line 299:
{notation} switch (strtolower($param1)) { case 'a4': $param1 = Zend_Pdf_Page::SIZE_A4; break; <--> default: // should be in "x:y" form } {notation}
So the comment should be changed to be "x:y:" or the count should be set to 2 (and then the constants need to be changed).
Posted by Christopher Thomas (cwt137) on 2009-12-17T20:23:18.000+0000
As the bug reporter said in the comment above, the right syntax is "x:y:". So the code should be:
So this item can be closed since it is not a bug.
Posted by R Slootjes (rslootjes) on 2009-12-18T02:56:15.000+0000
Not a bug indeed but still the comment needs to be updated.
from: // should be in "x:y" form to: // should be in "x:y:" form
Posted by Christopher Thomas (cwt137) on 2009-12-18T08:46:08.000+0000
R Slootjes: is this patch what you are looking for?
Posted by Alexander Veremyev (alexander) on 2009-12-18T09:10:54.000+0000
Both forms are supported now.