Skip to Content
0
Oct 20, 2019 at 06:08 PM

jspdf in fiori client

203 Views

Hi everyone,

I develop print pdf application with jspdf libray.this application will be used in fiori client and it will be used java portable.

When ı am testting application in fiori client with webide link, jspdf print is executing well but when ı deployed in system then try portable link,print is not working fiori client.But when ı try application in safari,android browser and google with portable link print is working.

How ı can execute in fiori client with portable link.

Regards..

My code is :

onPrintCanvas: function () {
var todoListId = "idGrid1";
var todoListElement = document.getElementById(todoListId);
sap.ui.core.BusyIndicator.show();
var that = this;
html2canvas(todoListElement, {
    width: todoListElement.clientWidth,
    height: todoListElement.clientHeight
}).then(function (canvas) {
   var imgData = canvas.toDataURL('#ffffff', "image/jpeg", 1.0);
   var pdf = undefined;
    var margin = 40;
    if (canvas.width > canvas.height) {
       pdf = new jsPDF('l', 'pt', [canvas.width + margin, canvas.height + margin]);
   } else {
      pdf = new jsPDF('p', 'pt', [canvas.height + margin, canvas.width + margin]);
   }
    pdf.addImage(imgData, 'JPEG', margin / 2, margin / 2, canvas.width, canvas.height, '', 'FAST');
   sap.ui.core.BusyIndicator.hide();
   if (sap.ui.Device.system.desktop) {
     pdf.save('isemri.pdf');
    } else {
         pdf.save('isemri.pdf');
    }
});
},