Skip to Content
Former Member
Oct 06, 2016 at 03:24 PM

Getting screenshots of SAPUI5 pie chart


Hi all,

I have been trying to get a screenshot of a pie chart with html2canvas ( library but I did not manage to get the png that I need. I have tried this:

        var vizFrame = this.getView().byId("idVizFrame");
        var vizFrameDOM = vizFrame.oParent.$();
            html2canvas(vizFrameDOM, {
                onrendered: function (canvas) {
                       var imgageData = canvas.toDataURL("image/png");
                       var newData = imgageData.replace(/^data:image\/png/, "data:application/octet-stream");
                       var a = document.createElement('a');
                       a.setAttribute("download", "your_pic_name.png");
                       a.setAttribute("href", newData);

and I got an empty image. Could anybody tell me what could be the reason and provide the solution ?

Thanks in advance.