I am unable to convert graph to PDF using vizFrame
in sapui5
using version 1.28.30 can't change version due to client. Here is my code please check and please help.
I am getting half of a graph as result PDF. For this i have imported all library which is needed like canvgg
, jsPdf
, rgbColor
, stackblur.js
.
pressToPdf:function(oEvent){
var oVizFrame = thatgrowth.getView().byId("ID_GROWTH_CHART_LENGTH_SCALE");
var id = thatgrowth.getView().byId("ID_GROWTH_CHART_LENGTH_SCALE").sId
var svg = $("#"+id).find("svg.v-m-root").outerHTML()
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
context.clearRect(0, 0, 600, 450);
canvgg(canvas, svg);
var imgData = canvas.toDataURL('image/png');
// Generate PDF
var doc = new jsPDF('p', 'pt', 'a4');
doc.addImage(imgData, 'PNG', 0, 0, 600, 450);
doc.save('GrowthChart.pdf');
},