Zend Framework

Custom pagesize results in fatal error

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.7.1
  • Fix Version/s: 1.9.7
  • Component/s: Zend_Pdf
  • Labels:
    None

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.

Activity

Hide
R Slootjes added a comment -

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

Show
R Slootjes added a comment - 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).
Hide
Christopher Thomas added a comment -

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

Unable to find source-code formatter for language: php. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
$objPage = new Zend_Pdf_Page('100:100:');

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

Show
Christopher Thomas added a comment - As the bug reporter said in the comment above, the right syntax is "x:y:". So the code should be:
Unable to find source-code formatter for language: php. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
$objPage = new Zend_Pdf_Page('100:100:');
So this item can be closed since it is not a bug.
Hide
R Slootjes added a comment -

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

Show
R Slootjes added a comment - 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
Hide
Christopher Thomas added a comment -

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

Show
Christopher Thomas added a comment - R Slootjes: is this patch what you are looking for?
Hide
Alexander Veremyev added a comment -

Both forms are supported now.

Show
Alexander Veremyev added a comment - Both forms are supported now.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: