Click here to Skip to main content
15,029,333 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Hello,
I have one div tag which content google map in my asp.net web application.
I want to convert that div into image so i can save it.
Any one have any idea about it?
Please let me know.
Thanks in advance.

What I have tried:

function genScreenshot() {
html2canvas(document.getElementById('dvMap'), {
onrendered: function(canvas) {
$('#box1').html("");
$('#box1').append(canvas);

if (navigator.userAgent.indexOf("MSIE ") > 0 ||
navigator.userAgent.match(/Trident.*rv\:11\./))
{
var blob = canvas.msToBlob();
window.navigator.msSaveBlob(blob,'Test file.png');
}
else {
$('#test').attr('href', canvas.toDataURL("image/png"));
$('#test').attr('download','Test file.png');
$('#test')[0].click();
}


}
});
}
Posted
Updated 21-Mar-18 10:17am

1 solution

That's almost certainly against Google's terms of use.

However, you can probably use the Google Static Maps API[^] to generate an image for your map.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900