WkHTMLtoPDF not loading local CSS and images

In my case – wkhtmltopdf version 0.12.2.1 (with patched qt) – adding a base tag to the head section with the absolute path made sure images and css did get loaded.

<html>
<head>
...
<base href="http://www.example.com/">
<link href="http://stackoverflow.com/assets/css/style.css" rel="stylesheet">
...
</head>

Leave a Comment