I recently spent some hours trying to find out why my SVG graph wasn’t rendering properly with wkhtmltopdf. Since the same problem might occur to others I wanted to share it here. So this is the issue: It seems like wkhtmltopdf has a problem with rendering when you use “stroke-dasharray” inside a SVG with a value of “0”, which may be used to set a path to a continuous line. Whenever this is used, wkhtmltopdf will fail to render the SVG properly (see bug report for further info).
If this happened to you while using Raphael.js you can fix this by updating a value inside the library. Raphael.js is using a “0” for “stroke-dasharray” whenever you either leave the value empty or use “none” as the value. Inside the library you will find this where an object “dasharray” is initialized (right above the initialization of the function “addDashes”). You can replace both zeros by a very high value, i.E. 99999. It only needs to be higher than the pixel length of your path, because then it will still be shown as a continuous line.
WebDevWonders.com
[ Your everyday web development resource ]