2

We are using:

Craft 3.4.20 with Commerce 3.1.4 and PHP 7.4.6 We tried to generate a PDF of an order with default settings and template in cp

We got following errors:

yii\base\ErrorException: Invalid characters passed for attempted conversion, these have been ignored in /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/lib/Cpdf.php:2545
Stack trace:
#0 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/ErrorHandler.php(74): yii\base\ErrorHandler->handleError(8192, 'Invalid charact...', '/Users/florianc...', 2545)
#1 [internal function]: craft\web\ErrorHandler->handleError(8192, 'Invalid charact...', '/Users/florianc...', 2545, Array)
#2 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/lib/Cpdf.php(2545): hexdec('space')
#3 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/lib/Cpdf.php(2669): Cpdf->openFont('/Users/florianc...')
#4 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/Adapter/CPDF.php(1006): Cpdf->selectFont('/Users/florianc...')
#5 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FontMetrics.php(310): Dompdf\Adapter\CPDF->get_font_height('/Users/florianc...', 12)
#6 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameReflower/Text.php(197): Dompdf\FontMetrics->getFontHeight('/Users/florianc...', 12)
#7 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameReflower/Text.php(372): Dompdf\FrameReflower\Text->_layout_line()
#8 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\FrameReflower\Text->reflow(Object(Dompdf\FrameDecorator\Block))
#9 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameReflower/Block.php(845): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow(Object(Dompdf\FrameDecorator\Block))
#10 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\FrameReflower\Block->reflow(NULL)
#11 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameReflower/Page.php(141): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
#12 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\FrameReflower\Page->reflow(NULL)
#13 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/Dompdf.php(847): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
#14 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/commerce/src/services/Pdf.php(167): Dompdf\Dompdf->render()
#15 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/commerce/src/controllers/DownloadsController.php(49): craft\commerce\services\Pdf->renderPdfForOrder(Object(craft\commerce\elements\Order), '')
#16 [internal function]: craft\commerce\controllers\DownloadsController->actionPdf()
#17 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#18 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#19 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('pdf', Array)
#20 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('pdf', Array)
#21 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('commerce/downlo...', Array)
#22 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('commerce/downlo...', Array)
#23 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#24 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#25 /Users/floriancrusius/dev/weingut-heddesdorff/web/index.php(21): yii\base\Application->run()
#26 /Users/floriancrusius/.composer/vendor/laravel/valet/server.php(191): require('/Users/florianc...')
#27 {main}

Many thanks

1
  • Can you edit the question to share the full stack trace leading up to the error?
    – Brad Bell
    Jul 8 '20 at 2:53
2

This is a known issue with dompdf on php 7.4: https://github.com/dompdf/dompdf/issues/2003

You can either downgrade your php version to 7.3 or install dompdf/dompdf 0.8.4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.