我有一个使用谷歌地图ip v3显示车辆行程的div。我正在使用html2canvas http://html2canvas.hertzen.com
。它工作正常,但如果你放大地图就失败了
html2canvas: Renderer: Canvas renderer done - returning canvas obj
html2canvas: Preload starts: finding background-images
html2canvas: Preload: Finding images
html2canvas: Preload: Done.
html2canvas: start: images: 1 / 35 (failed: 0)
html2canvas: start: images: 2 / 35 (failed: 0)
.
.
html2canvas: start: images: 30 / 35 (failed: 0)
html2canvas: start: images: 31 / 35 (failed: 0)
或者有时这是发生的事情。 (抱歉,我的声誉不到十,所以我无法上传图片)
放大(从浏览器打印屏幕)
http://i1207.photobucket.com/albums/bb480/zerodel_01/zoom2.jpg
输出html2canvas
http://i1207.photobucket.com/albums/bb480/zerodel_01/download4.png
这是我的代码:
function printme(){
html2canvas($('#maincontent'), {
proxy: "server.js",
useCORS: true,
logging: true,
onrendered: function(canvas) {
var imgString = canvas.toDataURL('image/png');
var mywindow = window.open('', 'my div', 'height=400,width=600');
mywindow.document.write('<html><head><title>my div</title>');
href="main.css" type="text/css" />');
mywindow.document.write('</head><body >');
mywindow.document.write("<img src='"+imgString+"'/>");
mywindow.document.write('</body></html>');
}
});
}