I have a small issue with mPDF (version 5.7.1).
This code should generate PDF with image file:
$mpdf = new mPDF();
$html = \'
It's enough The solve is :
$mpdf->curlAllowUnsafeSslRequests = true;
It's all
You can try this:
$mpdf->imageVars['myvariable'] = file_get_contents('alpha.png');
or
$html = '<img src="var:myvariable"/>';
$mpdf->WriteHTML($html);
after there, you should do:
$mpdf->Image('var:myvariable', 0, 0);
read more about this in documentation: mPDF Load Image
I am using Code Ignitor and mpdf. After installing php-gd5 library, I had to re-install the php with configure command --with-gd to resolve the issue
I have encountered the same problem after migrating the script.
The problem was, that the tmp
directory inside the mpdf folder was not writable. I hope it helps someone.
In my project i fix problem and solution is:
Set src absolute path on the server example:
src="/var/www/myproject/images/logo.png"
if image is on the same server.
If image is from external server src is absolute path example:
src="https://www.google.bg/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
.
Hope this will help someone.