var base64EncodedPDF = "JVBERi0xLjcNCiW..."; // the encoded string
var decodedPdfContent = atob(base64EncodedPDF);
var byteArray = new Uint8Array(decodedPdfContent.length)
for(var i=0; i<decodedPdfContent.length; i++){
byteArray[i] = decodedPdfContent.charCodeAt(i);
}
var blob = new Blob([byteArray.buffer], { type: 'application/pdf' });
var _pdfurl = URL.createObjectURL(blob);
if(!this._PDFViewer){
this._PDFViewer = new sap.m.PDFViewer({
width:"auto",
source:_pdfurl // my blob url
});
jQuery.sap.addUrlWhitelist("blob"); // register blob url as whitelist
}
this._PDFViewer.downloadPDF = function(){
File.save(
byteArray.buffer,
"Hello_UI5",
"pdf",
"application/pdf"
);
};
this._PDFViewer.open();
jQuery.sap.addUrlWhitelist(protocol, host, port, path);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
17 | |
15 | |
14 | |
11 | |
9 | |
8 | |
7 | |
7 | |
7 | |
7 |