I'm building an d3.js collapsible tree and used this (http://bl.ocks.org/mbostock/4339083) example for my work. This works great but I also will provide an option to download/export this tree as SVG/PDF/PNG. I searched a long time to handle this issue but it is allways the same result. The resulting SVG/PNG is faulty. To be exact the links between the nodes of the tree are faulty.
I tried these approaches:
For better understanding view this picture!