ZF-5156: Custom pagesize results in fatal error


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.


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).

As the bug reporter said in the comment above, the right syntax is "x:y:". So the code should be:

$objPage = new Zend_Pdf_Page('100:100:');

So this item can be closed since it is not a bug.

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

R Slootjes: is this patch what you are looking for?

Both forms are supported now.