ZF-5156: Custom pagesize results in fatal error

Issue Type: Bug Created: 2008-12-04T06:06:41.000+0000 Last Updated: 2009-12-18T09:10:54.000+0000 Status: Resolved Fix version(s): - 1.9.7 (11/Jan/10)

Reporter: R Slootjes (rslootjes) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Pdf

Related issues: Attachments: - ZF-5156.patch


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:

<pre class="literal">
$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 :

<pre class="literal">
$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.


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:

<pre class="highlight">
$objPage = new Zend_Pdf_Page('100:100:');

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.

Have you found an issue?

See the Overview section for more details.


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

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