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.
-
Popular Posts
- How to clear and disable DOM Storage in Firefox, IE and Chrome 19,134 view(s)
- Simple PHP crawler example 17,965 view(s)
- LZW compression and decompression with Javascript and PHP 13,747 view(s)
- Detecting Firefox add-ons 9,713 view(s)
- How to install, automate and secure AWStats including GeoIP-Plugin on Debian 8,551 view(s)
-
Latest Posts
- 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
- Fix for wkhtmltopdf rendering issue when using SVG
Categories
- Animation (2)
- Flex (1)
- HTML/CSS (10)
- Javascript (12)
- Linux (3)
- PHP (2)
- Ruby on Rails (1)
- Security/Privacy (6)
- Testing (1)
About me
Hey hey, my name's Jens Lübberstedt, I'm a RIA-/Web-Developer from Hamburg, Germany, currently living in Tanzania.
I am working with and blogging about all the fun web stuff such as JS/jQuery, PHP, Flex, HTML/CSS and more...Contact me right here or mail me directly: jens@webdevwonders.com
Blogged about:
actionscript adblock plus animation betterprivacy crawler cross-origin css css-hacks data-URI debian debug dom storage download facebook firebug firefox add-ons flash flex google analytics groupon history hack html5 http status code java javascript jquery linux localstorage lzw compression monkey patching netbeans pdf php plugins raphael.js redirect ruby on rails selenium sessionstorage super cookie svg testing webdevtoolbar windows wkhtmltopdf