1

I'd like to use the easyPrint leaflet plugin (from here: http://rowanwins.github.io/leaflet-easyPrint/) to export a map to image. All says this is best and will work but I have to struggle with following error message:

Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

Seems I'm the only one with this problem. My code is pretty straight forward like the examples.

var map = L.map('map', {
        center: bounds.getCenter(),
        minZoom: current_map.min_zoom,
        maxZoom: current_map.max_zoom,
        maxBounds: bounds,
        maxBoundsViscosity: 0.75,
    }
);

Tiles from https://tile.openstreetmap.org

Printing like this:

var printer = L.easyPrint({
    tileLayer: tiles,
    sizeModes: ['Current', 'A4Landscape', 'A4Portrait'],
    filename: 'myMap',
    exportOnly: true,
    hideControlContainer: true
}).addTo(map);

Is there anyone with a little help?

Ole_S
  • 356
  • 1
  • 3
  • 21

0 Answers0