There is a conflict with the Print module, which also requires the TCPDF library. The error occurs in "admin / reports / status" or when trying to generate a PDF using the Print module. Disable the "Sheetnode PHPExcel" module fixes the error.
I opened an issue for the library PHPExcel (http://phpexcel.codeplex.com/workitem/17750) and the Print module (#1512730: Fatal error: Cannot redeclare class TCPDF in sites/all/libraries/tcpdf/tcpdf.php on line 155 (Sheetnode module conflict)). The Print module maintainer, @jcnventura, has already responded and said:
The print_pdf module needs to include TCPDF at that point, to find out it's version number. It seems PHPExcel is also including TCPDF at that page - possibly always.
The only way to solve this would be to use namespaces to keep them separate. However, I don't have time to setup such a complicated scenario as the one you have. If you know enough PHP you should be able to create a print_pdf namespace in which the TCPDF class can be instantiated.
If you solve it, please share the patch.
Anyway, I wonder if there is something that can be done in Sheetnode to help to resolve this conflict...
Comments
Comment #1
soulfroysUnfortunately, namespace is only for PHP >= 5.3.0 :(
Any other suggestions? I really appreciate any help!
Comment #2
infojunkiePlease change the following code in sheetnode_phpexcel.module:
to
Does it work better?
Comment #3
soulfroys@infojunkie, sorry for the delay in responding ...
"class_exists" has no effect because the module Sheetnode PHPExcel library includes the class before the Print module (I think). I tried to change the weight but did not work either.
@jcnventura, the Print module manteiner, commited a patch that removes the TCPDF old versions validation to improve the Sheetnode integration, but now we have a new error message (http://drupal.org/node/1512730#comment-5823306).
Well .. I'll disable the Sheetnode PHPExcel module for now and wait for the new PHPExcel version (1.7.8) that will come with better flexibility for PDF (http://phpexcel.codeplex.com/SourceControl/changeset/view/89020#1606934):
Thank you very much for your attention!
Comment #4
infojunkieSheetnode PHPExcel *explicitly* needs TCPDF at this time to export HTML fragments to Rich Text (something that PHPExcel does not do automatically). So even when PHPExcel removes this dependency, Sheetnode PHPExcel will keep it. I will rework this dependency to decouple it from PHPExcel, and to try to make it compatible with the Print module.
Comment #5
soulfroysPHPExcel 1.7.8 is out...
http://phpexcel.codeplex.com/releases/view/96183
... and is no longer compatible with sheetnode:
Comment #6
soulfroysMarking this as duplicate in favor of #1822008: PDF export doesn't work with PHPExcel 1.7.8