d3js/SVG Export demo

d3js is a JavaScript library for manipulating documents based on data.
The library enables stunning client-side visualization inside the webbrowser.

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.

Source Code

The client-side code (HTML/CSS/Javascript) is contained in a single file (which you're seeing now). Click "view source" to see it. It is heavily documented.

The server-side code is a bare-bones Perl/CGI script.. It basically runs rsvg-convert and returns the result as an attachment to download. You can implement the same functionallity in any programming language.