introduce the d3js lib at version 3.4.12
here is testing code to get Base64 data for a very simple svg Image.
Sample code to show how to save base64 data as image on desktop.