Skip to Content
Feb 01, 2018 at 10:22 AM

Setting header Content-Disposition to the model


Hi All,

I want to display PDF in sap.m.PDFViewer control, for which i want to set the header of the model:

this.oModel.setHeaders({ "Content-Disposition": "inline" });

I bind this model to my fragment where my PDFViewer control is present.

However, in the network calls, i dont see the "Content-Disposition" header getting passed.

Also, when I make a call from controller, i see the "Content-Disposition" header getting passed in the Request headers.

I have also tried adding the header in the manifest.json under data source but nothing helps.

Where am i going wrong?

var oFileUploadConsentFragment = sap.ui.xmlfragment("myfragment", this);
	var sSrcPath = "myServiceURL" + "/Attachments('IdOfMyAttachment')/$value";
var oJsonData = {
				"Attachment": sSrcPath
var oConsentManagementModel = new sap.ui.model.json.JSONModel();	oConsentManagementModel.setData(oJsonData);
this.oFileUploadConsentFragment.setModel(oConsentManagementModel, "oJsonModel");
				"Content-Disposition": "inline"

XML Fragment:
<PDFViewer source="{oJsonModel>/Attachment}"></PDFViewer>