Jump to content

Cannot get Zend Framework (Zend_Pdf) to work


ovig

Recommended Posts

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:

[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[/code]

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:

[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);
?>

[/code]

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.