Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mPDF not showing image in generated PDF instead showing red x symbol and full url for background image

Recently I have moved from my staging server to production server and I don't have access to any of these servers. Both of these servers are linux.

On the new server while generating the pdf using mPDF with symfony 1.4 framework, images like rupee symbol are not getting displayed instead a small red "x" symbol is getting displayed in pdf.

Also, when I try to give background image to pdf, full image path like "http://example.com/image/rupee-image.jpg" is getting displayed instead of image.

Rupee symbol, other images and background images are working fine on my staging server.

When, I did $mpdf->showImageError(), It's saying "mPDF Image Error: Could not find image file" and pasting the url in browser displays the image perfectly.

Any help will be greatly appreciated.

like image 989
Uday Shankar Singh Avatar asked Oct 26 '25 03:10

Uday Shankar Singh


1 Answers

mPDF is telling you that it's not finding the image.

Without seeing your code it's difficult to hint you on what's wrong.

Still you probably what to try referring to your images using a full path locally.

So instead of reference like http://example.com/image/rupee-image.jpg

use something like /var/www/mysite/image/rupee-image.jpg , same as if checking the image is there using the command line.

HTH

like image 77
rtome Avatar answered Oct 28 '25 18:10

rtome



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!