SitePoint Sponsor

User Tag List

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

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

    Hi,

    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:

    Code:
    [client 127.0.0.1] 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 127.0.0.1] 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 127.0.0.1] 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:

    Code:
    <?php
    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);
    $page->drawText("Company",50,200);
    ?>
    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,

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


Bookmarks

Posting Permissions

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