Reputation: 13
wkhtmltopdf does not render images from other sites. I have discovered what many developers suggest just prefix an image file with :
file://
and add a full path. But this approach does not fit my needs. I need to render images from other site, because I have a separate image provider service.Also, I have tried --images flag.
Also I tried with google.com. But still I get pdf without any images.
xvfb-run wkhtmltopdf 'https://google.com' '/home/project/src/uploads/google.pdf'
P.S. I use wkhtmltopdf 0.12.3.2.
Upvotes: 1
Views: 4002
Reputation: 1
yes, this solved my problem, here is my full command :
exec('xvfb-run -a -s "-screen 0 640x480x16" -- /usr/bin/wkhtmltopdf --quiet --enable-local-file-access --page-size Letter /tmp/html.html /tmp/pdf.pdf');
Upvotes: 0
Reputation: 545
Adding -a -s "-screen 0 640x480x16"
as arguments for xvfb-run
is indeed what it solved for me as well.
So as already suggested above, this does render images:
xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf google.com test.pdf
Upvotes: 8