<p>This is a known issue with dompdf on php 7.4: <a href="https://github.com/dompdf/dompdf/issues/2003" rel="nofollow noreferrer">https://github.com/dompdf/dompdf/issues/2003</a></p>
<p>You can either downgrade your php version to 7.3 or install dompdf/dompdf 0.8.4.</p>

CC BY-SA 4.0
2020-07-15T16:54:26.633Z
2020-07-15T16:54:26.633Z
Francois Lévesque
<p>We are using:</p>
<p>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</p>
<p>We got following errors:</p>
<pre><code>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-&gt;handleError(8192, 'Invalid charact...', '/Users/florianc...', 2545)
#1 [internal function]: craft\web\ErrorHandler-&gt;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-&gt;openFont('/Users/florianc...')
#4 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/Adapter/CPDF.php(1006): Cpdf-&gt;selectFont('/Users/florianc...')
#5 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FontMetrics.php(310): Dompdf\Adapter\CPDF-&gt;get_font_height('/Users/florianc...', 12)
#6 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameReflower/Text.php(197): Dompdf\FontMetrics-&gt;getFontHeight('/Users/florianc...', 12)
#7 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameReflower/Text.php(372): Dompdf\FrameReflower\Text-&gt;_layout_line()
#8 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\FrameReflower\Text-&gt;reflow(Object(Dompdf\FrameDecorator\Block))
#9 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameReflower/Block.php(845): Dompdf\FrameDecorator\AbstractFrameDecorator-&gt;reflow(Object(Dompdf\FrameDecorator\Block))
#10 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\FrameReflower\Block-&gt;reflow(NULL)
#11 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameReflower/Page.php(141): Dompdf\FrameDecorator\AbstractFrameDecorator-&gt;reflow()
#12 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\FrameReflower\Page-&gt;reflow(NULL)
#13 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/dompdf/dompdf/src/Dompdf.php(847): Dompdf\FrameDecorator\AbstractFrameDecorator-&gt;reflow()
#14 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/commerce/src/services/Pdf.php(167): Dompdf\Dompdf-&gt;render()
#15 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/commerce/src/controllers/DownloadsController.php(49): craft\commerce\services\Pdf-&gt;renderPdfForOrder(Object(craft\commerce\elements\Order), '')
#16 [internal function]: craft\commerce\controllers\DownloadsController-&gt;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-&gt;runWithParams(Array)
#19 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller-&gt;runAction('pdf', Array)
#20 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&gt;runAction('pdf', Array)
#21 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module-&gt;runAction('commerce/downlo...', Array)
#22 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application-&gt;runAction('commerce/downlo...', Array)
#23 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application-&gt;_processActionRequest(Object(craft\web\Request))
#24 /Users/floriancrusius/dev/weingut-heddesdorff/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
#25 /Users/floriancrusius/dev/weingut-heddesdorff/web/index.php(21): yii\base\Application-&gt;run()
#26 /Users/floriancrusius/.composer/vendor/laravel/valet/server.php(191): require('/Users/florianc...')
#27 {main}
</code></pre>
<p>Many thanks</p>

CC BY-SA 4.0
2020-07-08T02:53:33.647Z
Can you edit the question to share the full stack trace leading up to the error?
Brad Bell
<craft3><plugin-craftcommerce3><dompdf>
Generate PDF Receipt in Craft commerece causes error in dompdf
# Generate PDF Receipt in Craft commerece causes error in dompdf

(Asked by: username_0 on 2020-07-07)

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

**Tags:** craft3, plugin-craftcommerce3, dompdf

> **Comments:**
> **username_1**: Can you edit the question to share the full stack trace leading up to the error?  

---

## 1 answers

### Answer by username_2 on 2020-07-15. Score: 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.


---

