Forum


Replies: 3   Views: 3971
Cannot redeclare class tcpdf
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 therasim  · 28-02-2017 - 12:01

I'm using PHPDocX and Spipu's HTML2PDF library (https://github.com/spipu/html2pdf) together. With PHPDocX I'm not generating any PDF documents; however, I'm getting this error when I try to generate my Word document:

Fatal error: Cannot redeclare class TCPDF in /files/www/html/phpdocx/lib/pdf/tcpdf/tcpdf.php on line 152

Is there a way to bypass this error? Or is there a line I can modify to check if the library was already called?

Thanks in advance for any hints

Posted by therasim  · 28-02-2017 - 12:16

I commented the line 

spl_autoload_register(array('Phpdocx\AutoLoader', 'autoloadPdf'));

in the AutoLoader.inc and that seemed to work for me; I just wonder if that's the right way to deal with this or do you have another suggestion?

Posted by admin  · 28-02-2017 - 12:50

Hello,

UPDATE: we recommend using the namespaces package available in Advanced and Premium licenses.

Regards.

Posted by therasim  · 28-02-2017 - 12:56

Thanks for your response. For now I'll leave this fix and wait until you integrate the check for classes already installed