I'm using html2Canvas library and trying to make a screenshot of a SVG with this code:
var svgElements= $container.find('svg');
svgElements.each(function (){
var canvas, xml;
canvas = document.createElement("canvas");
canvas.className = "screenShotTempCanvas";
//convert SVG into a XML string
xml = (new XMLSerializer()).serializeToString(this);
xml = xml.replace(/xmlns=\"http:\/\/www\.w3\.org\/2000\/svg\"/, '');
canvg(canvas, xml);
$(canvas).insertAfter(this);
this.className"tempHide";
$(this).hide();
});
$container.find('.screenShotTempCanvas').remove();
$container.find('.tempHide').show().removeClass('tempHide');
but my problem is that I have a input (foreignObject) inside the svg. The screenshot that it takes, contains only the svg elements. Anyone has a solution for this? How I can I capture all the elements on page?
Thank!