Skip to Content

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);
this.getView().addDependent(oFileUploadConsentFragment);
	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");
this.getView().getModel().setHeaders({
				"Content-Disposition": "inline"
			});
this.oFileUploadConsentFragment.setModel(this.getView().getModel());



XML Fragment:
<PDFViewer source="{oJsonModel>/Attachment}"></PDFViewer>
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.