DomPDF: Image is unreadable or empty
P粉743288436
2023-08-29 14:06:26
<p>For some reason, DomPDF does not render images contained in the html it is parsing: </p>
<p>However, when the image is returned as html, the image is rendered on the page: </p>
<p>I've looked at these questions and made sure DOMPDF_ENABLE_REMOTE is set to true and verified file permissions: </p><p>
dompdf image is not a real image, cannot be read or is empty</p><p>
Image error in ZF2's DOMPDF</p>
<p>Is there anything else I should check? </p>
Since another answer suggested enabling the remote option in
module.config.php
and I haven't been able to add a comment yet, I thought it would be best to answer that the file does not exist in newer versions of DomPDF.If you need to include a remotely stored image in a newer version, you must pass it as an option to the constructor:
This solved the problem I was having.
The following helped me fall in love with glamour, at least locally, even with
The solution is to change the SRC of the image to the absolute path on the server, as follows:
All of the following worked for me:
$_SERVER["DOCUMENT_ROOT"] is C:/wamp/www/ZendSkeletonApplication/public
Thanks for this: Lost in Code