error in pdf image using dompdf
I have to display a logo in every page of a generated PDF. Though it works fine in the local system, it throws following exception in the server:
Fatal error: Uncaught exception 'PDFlibException' with message 'Handle parameter or option of type 'image' has bad value 0' in /var/www/dev/subdomains/rfqms/httpdocs/sprintnineteen/system/plugins/dompdf/include/pdflib_adapter.cls.php:664 Stack trace: #0 /var/www/dev/subdomains/rfqms/httpdocs/sprintnineteen/system/plugins/dompdf/include/pdflib_adapter.cls.php(664): PDFlib->fit_image(0, 30, 746, 'boxsize={86 43}...') #1 /var/www/dev/subdomains/rfqms/httpdocs/sprintnineteen/system/plugins/dompdf/include/php_evaluator.cls.php(66) : eval()'d code(16): PDFLib_Adapter->image('http://rfqms.de...', 'jpg', 30, 3, 86.4, 43.2) #2 /var/www/dev/subdomains/rfqms/httpdocs/sprintnineteen/system/plugins/dompdf/include/ph开发者_开发知识库p_evaluator.cls.php(66): eval() #3 /var/www/dev/subdomains/rfqms/httpdocs/sprintnineteen/system/plugins/dompdf/include/php_evaluator.cls.php(70): PHP_Evaluator->evaluate('??//$base_img_u...') #4 /var/www/dev/subdomains/rfqms/httpdocs/sprintnineteen/system/plugins/dompdf/include/renderer.cls.php(180): PHP_Evaluator->render(O in /var/www/dev/subdomains/rfqms/httpdocs/sprintnineteen/system/plugins/dompdf/include/pdflib_adapter.cls.php on line 664
After some analysis I found that in local it uses cpdf_adapter.cls.php
for image, where as in server it uses pdflib_adapter.cls.php
for image.
I even tried for all the types of images according to:
pdfLib tutorial Version 8.0.2 ---page # 166--- Inline images are only supported for imagetype=ccitt, jpeg, and raw. For other image types the inline option will silently be ignored.
So, what is the problem that leads to this exception?
some additional info:
- local PHP Version 5.3.0
- server PHP Version 5.2.16
- dompdf version 0.5.2
- DOMPDF_TEMP_DIR has r/w/e permission
- local machine is windows vista
- server machine is linux
There was a bug in dompdf at some point related to adding images via PDFLib. I'm not sure if the issue has been addressed yet or not for the upcoming 0.6.0 release. There is a relevant thread on the support group. Take a look at my last post there for information on a work-around if you want to continue using PDFLib.
The other option would be to tell dompdf to use CPDF. In dompdf_config.inc.php set DOMPDF_PDF_BACKEND
to "CPDF" instead of "auto" or "PDFLib".
精彩评论