我正在使用此方法将包含WMS图层的Map转换为图像,然后在PDF中使用该图像。对于WFS层,一切都可以正常工作,但对于WMS层,一切都没有问题。
function CaptureImage() {
map.once('postcompose', function(event) {
console.log(event);
var canvas = event.context.canvas;
console.log(canvas);
if (navigator.msSaveBlob) {
navigator.msSaveBlob(canvas.msToBlob(), 'map.png');
} else {
canvas.toBlob(function(blob) {
var imgData = new Image();
imgData = canvas.toDataURL("png");
// Later I'm saving this image, but this is working for WFS, but not WMS Layers ;
});
}
});
}