<div id="Contents">
<div style="float:left;margin-left:10px;">
<svg></svg>
</div>
<div style="float:left;margin-left:10px;">
<svg></svg>
</div>
</div>
This is my html code. I want to convert it canvas image.
html2canvas($("#Contents"), {
onrendered: function(canvas) {
window.open(canvas.toDataURL());
}
});
I use html2canvas plugin for convert it to image but It does not show svg. I solve converting svg tp canvas but now html2canvas not working
var $to=$("#MainContents").clone();
$($to).children(".box").each(function() {
var svg = ResizeArray[$(this).children(".box-content").children().attr("new-id")-1].svg();
var Thiscanvas = document.createElement("canvas");
Thiscanvas.setAttribute("style", "height:" + 100 + "px;width:" + 100+ "px;");
canvg(Thiscanvas, svg);
$(this).append(Thiscanvas);
});
html2canvas($($to), {
onrendered: function(canvasq) {
var w=window.open(canvasq.toDataURL());
w.print();
}
});
I can convert svg to canvas but html2canvas function not working.