score:0

i'm not familiar with d3.js ,

before that, i have to know that, does your code working well for single svg? you got a error on multiple svg used right?

if it is, you will try the following code

function saveimage(){

var html = d3.selectall("svg")
    .attr("version", 1.1)
    .attr("xmlns", "http://www.w3.org/2000/svg")
    .node().parentnode.innerhtml;
for(var i=0;i<html.length;i++)
{
var imgsrc = 'data:image/svg+xml;base64,'+ btoa(html[i]);
var img = '<img src="'+imgsrc+'"/>';
d3.select("#svgdataurl").html(img);
console.log(html[i]);
}
};

Related Query

More Query from same tag