I am using barryvdh/laravel-snappy package in Laravel framework to convert html file into PDF.
It is working fine, but images in the PDF are not getting displayed.
Image path used in the html is like:
Here is the link of html:
https://staging.easydmc.com/test?html=true
And the link to generated PDF is:
https://staging.easydmc.com/test?html=false
Earlier the images were working fine in the PDF. A few days back I had executed the command – sudo apt upgrade. I do not whether this is causing the problem or not.
I tried re-installing the package barryvdh/laravel-snappy, but no success.
Any help would be appreciated.
PHP version: 8.0
Server: Nginx
Laravel: 8.51.0
2
Answers
I got the solution:
First I checked whether there is an issue or not while generating the PDF using below command:
I got to know below issues:
The solution on above problem was to install libssl1.0-dev:
So my PDF link https://staging.easydmc.com/test?html=false in original question started working now.
I previously had this issue, it is because of
wkhtmltopdf
. You should use storage full path instead of web url.For example instead of using:
use something like this:
to get the full storage path you can use code like below: