Last post Dec 04, 2017 01:11 AM by Deepak Panchal
Member
2 Points
8 Posts
Dec 03, 2017 03:36 PM|Ramyayadav|LINK
Contributor
2990 Points
1210 Posts
Dec 04, 2017 01:11 AM|Deepak Panchal|LINK
Hi Ramyayadav,
you need to use "Canvas2image" to save div as image.
syntax:
Canvas2Image.saveAsImage(canvasObj, width, height, type)
example:
$(function() { $("#btnSave").click(function() { html2canvas($("#widget"), { onrendered: function(canvas) { theCanvas = canvas; document.body.appendChild(canvas); // Convert and download as image Canvas2Image.saveAsPNG(canvas); $("#img-out").append(canvas); // Clean up //document.body.removeChild(canvas); } }); }); });
for detailed example please refer link below.
JS Fiddle live example
Reference:
https://github.com/hongru/canvas2image
Regards
Deepak
Member
2 Points
8 Posts
Save contents of div as image on server
Dec 03, 2017 03:36 PM|Ramyayadav|LINK
<br>
I want to capture the contents inside a div(like text box or asp control) as image on button click in javascript<br>
Contributor
2990 Points
1210 Posts
Re: Save contents of div as image on server
Dec 04, 2017 01:11 AM|Deepak Panchal|LINK
Hi Ramyayadav,
you need to use "Canvas2image" to save div as image.
syntax:
example:
for detailed example please refer link below.
JS Fiddle live example
Reference:
https://github.com/hongru/canvas2image
Regards
Deepak
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.