admin管理员组文章数量:1429061
Iam doing screenshot using html2canvas with this method:
makeScreenshot: function (button) {
html2canvas(document.body, {
onrendered: function(canvas) {
new Ext.Window({
title: 'Screenshot',
width: 800,
height: 600,
resizable: true,
autoScroll: true,
preventBodyReset: true,
html: '<img src="' + canvas.toDataURL("image/png") + '" height="800"/>'
}).show();
}
});
}
getting this screenshot (on the image left dialog/window named Screeshot)
as you can see, google map is not generated, just circles. also a charts ar not in the screenshot. what is wrong?
Iam doing screenshot using html2canvas with this method:
makeScreenshot: function (button) {
html2canvas(document.body, {
onrendered: function(canvas) {
new Ext.Window({
title: 'Screenshot',
width: 800,
height: 600,
resizable: true,
autoScroll: true,
preventBodyReset: true,
html: '<img src="' + canvas.toDataURL("image/png") + '" height="800"/>'
}).show();
}
});
}
getting this screenshot (on the image left dialog/window named Screeshot)
as you can see, google map is not generated, just circles. also a charts ar not in the screenshot. what is wrong?
Share Improve this question asked Sep 11, 2013 at 13:54 r.rr.r 7,18329 gold badges90 silver badges132 bronze badges3 Answers
Reset to default 3The map-tiles are images which may not be rendered, because the are located on a different domain.
From the documentation:
Limitations
All the images that the script uses need to reside under the same origin for it to be able to read them without the assistance of a proxy.
Add useCORS: true will solve this issue.
makeScreenshot: function (button) {
html2canvas(document.body, {
useCORS: true,
onrendered: function(canvas) {
new Ext.Window({
title: 'Screenshot',
width: 800,
height: 600,
resizable: true,
autoScroll: true,
preventBodyReset: true,
html: '<img src="' + canvas.toDataURL("image/png") + '" height="800"/>'
}).show();
}
});
}
For Google chart i spent all the night to find a solution and finally it was so simple: before calling html2canvas, convert the charts rendered to canvas with canvg(). Charts of Google are svg.
本文标签: why google maps and charts are not supported by html2canvas in javascriptStack Overflow
版权声明:本文标题:why google maps and charts are not supported by html2canvas in javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745543721a2662609.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论