rob.m
rob.m

Reputation: 10591

html2canvas not grabbing svg

When I run this:

html2canvas(document.body, {
allowTaint: true,
  onrendered: function(canvas) {
    document.body.appendChild(canvas);
  }
});

I have my whole page grabbed into a canvas, but the SVG isn't. Been looking around but I couldn't find anything helpful to solve it, any idea?

Upvotes: 0

Views: 1289

Answers (1)

rob.m
rob.m

Reputation: 10591

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()
});

Upvotes: 1

Related Questions