barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.66k stars 966 forks source link

Image not showing tried everything #959

Closed umairge66 closed 9 months ago

umairge66 commented 1 year ago

I am using this library there are many issues but the most frustrating issue is the image is not showing in pdf

parallels999 commented 1 year ago

https://github.com/barryvdh/laravel-dompdf/blob/424a223ce80e7afc8bfb6e84449679efe272fbb5/.github/ISSUE_TEMPLATE/bug_report.md?plain=1#L10-L12

This is just a Dompdf wrapper! I understand that this package is just a Laravel wrapper for https://github.com/dompdf/dompdf Any issues with PDF rendering, CSS that is not applied correctly, aligning/fonts/characters etc that are not directly related to this package, should be reported there. When having doubts, please try to reproduce the issue with just dompdf. If it's also present there, do not open an issue here please.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

Mike-Carolan commented 1 year ago

I had this issue as well - solved by using the built-in base64_encode function. $image = file_get_contents('path_to_png_image'); $img_data = base64_encode($image);

Then render in html:
<img alt="" src="data:image/png;base64, ' . $img_data . '">
umairge66 commented 9 months ago

thanks @Mike-Carolan solved my problem