Commonly in science-related websites (and possibly many others), users need to save the generated visualization in vectorized format (e.g. PDF), to be able to incorporate the graphics in presentation or publications.
This website demonstate one possible method of saving d3js graphics to PDF.
See below for more technical details.
create_d3js_drawing()function in this HTML file.).
XMLSerializer.serializeToString()to extract the SVG/XML structure of the d3js drawing
show_svg_code()function in this HTML file).
rsvg-convertand returns the result as an attachment to download. You can implement the same functionallity in any programming language.