I'm trying to upload screenshot to server through php or ajax. But I can't figure out Where the screenshot is being made in the html2canvas()? I have searched about that but didn't find solution. Please review my code and guide me.
JS Code
$(function () {
$("#btnSave").click(function () {
html2canvas($("#widget"), {
onrendered: function (canvas) {
theCanvas = canvas;
var image = canvas.toDataURL("image/jpeg");
$('#captured_img').attr("src", image);
$('#img_val').attr("value", image);
}
});
});
HTML Code
<div id="widget" class="widget">
<h1>THE IMAGE</h1>
</div>
<input type="hidden" name="img_val" id="img_val" value=""/>
<div id="showImage">
<img id="captured_img" src="" height="120" width="100"/>
</div>
<input type="button" id="btnSave" value="Save PNG"/>