1

我想使用easyPrint传单插件(从这里:http ://rowanwins.github.io/leaflet-easyPrint/ )将地图导出到图像。所有人都说这是最好的并且会起作用,但我必须努力解决以下错误消息:

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

似乎我是唯一有这个问题的人。我的代码就像示例一样非常简单。

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

来自https://tile.openstreetmap.org的瓷砖

像这样打印:

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

有没有人有一点帮助?

4

0 回答 0