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.
- How to clear and disable DOM Storage in Firefox, IE and Chrome 32,387 views
- Simple PHP crawler example 29,005 views
- How to install, automate and secure AWStats including GeoIP-Plugin on Debian 21,932 views
- Detecting browser plugins 13,251 views
- How to install MongoDB on Debian including PHP driver and Munin-Plugin
- HAProxy Load Balancer setup including logging on Debian
- Configuring a permanent SSH tunnel for MySQL connections on Debian
- How to install, automate and secure AWStats including GeoIP-Plugin on Debian
- How to animate a rectangle bottom up with Raphaël.js