Wkhtmltopdf Not Loading Local CSS and Images

WkHTMLtoPDF not loading local CSS and images

If your are on linux check the ownership of your images. For windows you will find some info on http://code.google.com/p/wkhtmltopdf/wiki/Usage.

I tried different kind of paths to the image:

  1. <img src="file:///var/www/testpdf/flowers.jpg"><br>
  2. <img src="./flowers.jpg"><br>
  3. <img src="flowers.jpg"><br>
  4. <img src="/var/www/testpdf/flowers.jpg"><br>

all images are showed correct. I didn't use any command line arguments
(only wkhtmltopdf /var/www/testpdf/makepdf.html makepdf.pdf)

KnpSnappyBundle - wkhtmltopdf: CSS/images are loaded but not scripts

I see you're using bootstrap 4 (flexbox). This is not supported in wkhtmltopdf stable version (0.12.x). For further information see here. Unfortunately there is no development activity at the moment, so it can take a long time until this will be supported.

There are some not complete alternatives like puppeteer (doesn't have TOC at the moment).

wkhtmltopdf wont take images inside html files

The windows version of wkhtmltopdf 0.11.0 rc1 does not support gif images. Workaround: preprocess all images in incoming HTML and convert them into jpgs.

Issue described in: http://code.google.com/p/wkhtmltopdf/issues/detail?id=441

Gifs work in wkhtmltopdf 0.9.9.



Related Topics



Leave a reply



Submit