SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member ovig's Avatar
    Join Date
    May 2006
    0 Post(s)
    0 Thread(s)

    Question Help - Can't get Zend Framework (Zend_Pdf) to work


    I'm trying to use the Zend Framework to generate PDF's on the fly, and get the damn thing to work. It's probably not a bug - just me missing something - but for the life of me, I can't see what ;-)

    First of all, here's the apache log file with the details of the problem:

    [client] PHP Notice:  Use of undefined constant self::PAGESIZE_A4 - assumed 'self::PAGESIZE_A4' in /usr/share/php5/ZendFramework-0.1.3/library/Zend/Pdf/Page.php on line 184
    [...and then one more line like this for every other PAGESIZE...]
    [client] PHP Notice:  Use of undefined constant self::FONT_TIMES_ROMAN - assumed 'self::FONT_TIMES_ROMAN' in /usr/share/php5/ZendFramework-0.1.3/library/Zend/Pdf/Resource/Font/Standard.php on line 36
    [...and then one more line like this for every other FONT...]
    [client] PHP Fatal error:  Uncaught exception 'Zend_Pdf_Exception' with message 'Wrong font name' in /usr/share/php5/ZendFramework-0.1.3/library/Zend/Pdf/Resource/Font/Standard.php:37\nStack trace:\n#0 /usr/share/php5/ZendFramework-0.1.3/library/Zend/Pdf/Resource/Font/Standard.php(37): Zend_Pdf_Font_Standard::__construct()\n#1 /srv/www/htdocs/eSecurity/invoice.php(86): Zend_Pdf_Font_Standard->__construct('Courier')\n#2 {main}\n  thrown in /usr/share/php5/ZendFramework-0.1.3/library/Zend/Pdf/Resource/Font/Standard.php on line 37
    I know that only the last logline is the actual error, but as there are a lot of notices that seem to be somewhat related, I've included them.

    The code that produces this error is below - it is pretty much directly taken from the Framework documentation:

    set_include_path ('/usr/share/php5/ZendFramework-0.1.3/library');
    require_once 'Zend/Pdf.php';
    $pdf = new Zend_Pdf();
    $pdf->pages[] = new Zend_Pdf_Page(Zend_Pdf_Const::PAGESIZE_A4);
    $pdfPage->setFont(new Zend_Pdf_Font_Standard(Zend_Pdf_Const::FONT_COURIER), 12);
    The Framework is installed in /usr/share/php5; it is part of the include path thanks to the set_include_path() call - and that seems to be working OK as the path is picked up in the logs, and the call to the Zend_Pdf and Zend_Pdf_Page constructors are OK.
    I run all this on a OpenSUSE 10.0 box, with the standard apache2- PHP 5.0.4, and v0.1.3 of the Framework (downloaded as a "package" rather than from the SVN repository).

    Thanks in advance,

    Last edited by ovig; May 4, 2006 at 05:03.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts