这就是我正在做的事情,点击按钮并将我的页面主体绘制到画布
jQuery("#print").on("click", function() {
myCapture();
});
function myCapture() {
html2canvas(document.body, {
allowTaint: true,
useCORS: true,
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
}
虽然有效,但地图显示时没有任何多边形
答案 0 :(得分:1)
我通过告诉leaflet to provide tiles as canvas而不是svg
jQuery("#print").on("click", function() {
myCapture();
});
function myCapture() {
html2canvas(document.body, {
allowTaint: true,
useCORS: true,
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
}
var map = L.map('map', {
renderer: L.canvas()
});