2

I'm trying to add a button to my interface that will download a screenshot taken of the web page. It works for the side bar but my Cesium map appears plain white.

Can someone help me out with is?

Here is a code

var Capture = function() {
html2canvas(document.body, {
    onrendered: function (canvas) {
        var tempcanvas=document.createElement('canvas');
        tempcanvas.width=1050;
        tempcanvas.height=1050;
        var context=tempcanvas.getContext('2d');
        context.drawImage(canvas,5,5);
        var link=document.createElement("a");
        link.href=tempcanvas.toDataURL('image/jpg');   //function blocks CORS
        link.download = 'screenshot.jpg';
        link.click();
    }
});

}

This was based on the question asked here

Pink Ama
  • 65
  • 7

1 Answers1

1

So the answer turned out to be by using scene.canvas. I was directed to this solution by a similar question on the Cesium Forum.

Pink Ama
  • 65
  • 7