{
"welcomeFile": "/webapp/index.html",
"authenticationMethod": "saml",
"routes": [
{
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
},
{
"path": "/test-resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/test-resources"
},
"description": "SAPUI5 Resources"
}
{
"path": "/render",
"target": {
"type": "destination",
"name": "pdf_render_oAuth"
},
"description": "pdf_render_oAuth"
},
{
"path": "/webapp/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
},
{
"path": "/webapp/test-resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/test-resources"
},
"description": "SAPUI5 Test Resources"
}
],
"sendWelcomeFileRedirect": true
}
renderPDF: function () {
//Generate the token
var modeldata = this.getView().getModel().getData();
//Build the xml data with the data from the model
var xmldata =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><form1><InvoiceNo>" + modeldata.Invoices[0].Invoiceno + "</InvoiceNo><InvoiceTo>" +
modeldata.Invoices[0].Invoiceaddress + "</InvoiceTo><InvoiceTotal>" + modeldata.Invoices[0].Invoiceamount +
"</InvoiceTotal></form1>";
var encdata = btoa(xmldata);
//prepare the render API call. Pick up the template from template store
var jsondata = "{ " + "\"xdpTemplate\": \"" + "InvoiceData/Invoice" + "\", " + "\"xmlData\": \"" + encdata + "\"}";
var url_render = "/render/v1/adsRender/pdf?templateSource=storageName";
//make the API call
$.ajax({
url: url_render,
type: "post",
contentType: "application/json",
data: jsondata,
success: function (data, textStatus, jqXHR) {
//once the API call is successfull, Display PDF on screen
var decodedPdfContent = atob(data.fileContent);
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
});
jQuery.sap.addUrlWhitelist("blob"); // register blob url as whitelist
}
this._PDFViewer.open();
},
error: function (data) {
}
});
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
14 | |
10 | |
7 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 |