Forum


Replies: 2   Views: 3817
Transformdoc::generatepdf() does not find dompdf class
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by by_lexus  · 26-04-2012 - 07:48

Hi,

Your example:
[code]
require_once 'classes/TransformDoc.inc';

$document = new TransformDoc();
$document->setStrFile('Text.docx');
$document->generatePDF();
[/code]

does not work in PHP 5.3: The function "DOMPDF_autoload()" in phpdocx/pdf/dompdf_config.inc.php is never called.

This can be downtracked to the following lines:

[code]
// Line 383 in dompdf_config.inc.php:
// If PHP >= 5.3 the $prepend argument is available
else if ( version_compare(PHP_VERSION, '5.3', '>=') ) {
spl_autoload_register($autoload, true, true);
}
[/code]

If the spl_autoload_register is called with "false" as 3rd parameter, it works:

[code]
spl_autoload_register($autoload, true, false);
[/code]

It seems like an order issue in calling spl_autoload_register in another part of the program.

Please add this as a bug, as it is not working as you suggested in PHP 5.3.

regards
alex

Posted by admin  · 11-04-2013 - 12:13

Hello,

A user has referenced this post. This server config is working fine:

------------------------------------------------------------------------------------------
PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug 6 2012 20:08:59)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
------------------------------------------------------------------------------------------

So seems there're some config or version related to that issue. Could you paste your server config?

Regards.