Hi Juan,
DOMPDF defines an autoload method, but uses __autoload() instead of
spl_autoload_register(). You should file a bug with the maker of this
software to correct this issue. In the meantime, you need to add this to
your code:
require_once 'dompdf_config.inc.php';
spl_autoload_register('DOMPDF_autoload');
Incidentally, there is no advantage to using Zend_Loader::loadFile() over a
simple require_once statement when you are loading a specific file (in other
words, not using a dynamically-constructed filename).
Hope that helps,
-Matt
On Fri, Aug 22, 2008 at 4:27 PM, Juan Felipe Alvarez Saldarriaga <
[EMAIL PROTECTED]> wrote:
> Hey!
>
> I like to use dompdf to render HTML -> PDF, but I can't use it in Zend
> Frameowrk, my bootstrap calls the registerAutoload method:
>
> Zend_Loader::registerAutoload();
>
> I already have include the paths to the dompdf in my .htaccess file:
>
> dompdf folder content:
> /home/jfalvarez/php5/site/library/dompdf-0.5.1
>
> [EMAIL PROTECTED]:~/php5/site/library/dompdf-0.5.1$ ls -l
>
> -rw-r--r-- 1 jfalvarez devs 32K Jul 7 2006 ChangeLog
> -rw-r--r-- 1 jfalvarez devs 1.2K Jul 7 2006 HACKING
> -rw-r--r-- 1 jfalvarez devs 4.5K Jul 7 2006 INSTALL
> -rw-r--r-- 1 jfalvarez devs 26K Jul 7 2006 LICENSE.LGPL
> -rw-r--r-- 1 jfalvarez devs 9.8K Jul 7 2006 README
> -rw-r--r-- 1 jfalvarez devs 5.0K Jul 7 2006 TODO
> -rwxr-xr-x 1 jfalvarez devs 7.8K Jul 7 2006 dompdf.php
> -rw-r--r-- 1 jfalvarez devs 6.7K Jul 7 2006 dompdf_config.inc.php
> drwxr-xr-x 2 jfalvarez devs 4.0K Jul 7 2006 include
> drwxr-xr-x 4 jfalvarez devs 4.0K Jul 7 2006 lib
> -rw-r--r-- 1 jfalvarez devs 7.8K Jul 7 2006 load_font.php
> drwxr-xr-x 4 jfalvarez devs 4.0K Jul 7 2006 www
>
> htaccess file:
> php_value include_path
> ".:/home/jfalvarez/php5/site/library/dompdf-0.5.1/lib:/home/jfalvarez/php5/site/library/dompdf-0.5.1"
>
> So, like the dompdf example, I'm trying this:
>
> class IndexController extends Zend_Controller_Action
> {
> public function testAction()
> {
> require_once( "dompdf_config.inc.php" );
>
> $strHtml = <<<HTML
> <html>
> <body>
> <h1>;-)</h1>
> </body>
> </html>
> HTML;
>
> // Zend_Loader::loadFile( "dompdf.php" );
> require_once( "dompdf.php" );
>
> $objDomPdf = new DOMPDF();
>
> $objDomPdf->load_html( $strHtml );
>
> $objDomPdf->render();
>
> $objDomPdf->stream( ROOT_APPLICATION_PATH .
> "/tmp/mostro1.pdf" );
> }
> }
>
> But when I try to do something I always have an error, saying this:
>
> Warning: Zend_Loader::include_once(DOMPDF/Exception.php)
> [function.Zend-Loader-include-once]: failed to open stream: No such file or
> directory in /usr/local/lib/fw/php/phpzend-1.5.2/library/Zend/Loader.php on
> line 83
>
> Warning: Zend_Loader::include_once() [function.include]: Failed opening
> 'DOMPDF/Exception.php' for inclusion
> (include_path='.:/home/jfalvarez/php5/site/library/:/usr/local/lib/fw/php/phpzend-1.5.2/library/:/home/jfalvarez/php5/site/functions/:/home/jfalvarez/php5/site/library/dompdf-0.5.1/include:/home/jfalvarez/php5/site/library/dompdf-0.5.1/lib:/home/jfalvarez/php5/site/library/dompdf-0.5.1')
> in /usr/local/lib/fw/php/phpzend-1.5.2/library/Zend/Loader.php on line 83
>
> Fatal error: Class 'DOMPDF_Exception' not found in
> /home/jfalvarez/php5/site/library/dompdf-0.5.1/dompdf.php on line 229
>
> Actually, the dompdf exception class name is DOMPDF_Exception so the
> framework try to look into the folder DOMPDF for the file Exception which is
> not, so there's no way to work with 3rd party libs ?
>
> Thx for any help.
>