This is what I am doing, a click on a button and drawing my page body into a canvas
jQuery("#print").on("click", function() {
myCapture();
});
function myCapture() {
html2canvas(document.body, {
allowTaint: true,
useCORS: true,
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
}
That works but the map is shown without any polygon
I resolved it by telling leaflet to provide tiles as canvas and not as an 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()
});