cancel
Showing results for 
Search instead for 
Did you mean: 

To view PDF in a full screen

GowthamRaja
Participant
0 Kudos

Hi Experts,

I have a PDF attachment icon in my view, if i click the icon the PDF should display. Please let me know how this could be done.

view.xml:

Controller.js:

i have the value for pdf also, but i do know how to proceed further.

Please help me

Thanks,

Gowtham

Accepted Solutions (1)

Accepted Solutions (1)

irfan_gokak
Contributor
0 Kudos

Hi,

Its looks like binary data in base64 format.

Best approach to display any media files in UI5/Fiori apps is to create entity type media and call GET_STREAM method. It will give you url with .../.../$value.

If you want to go with current approach then,

1>> To open in new tab.

window.open('data:application/pdf;base64,'+oContainer, '_blank');

2>> To open in your UI5 app in same view.

In View:

<Panel id="idPanel" > </Panel>

In Controller:

var oPanel = this.getView().byId("idPanel");
var data = "data:application/pdf;base64,"+oContainer;
var html = new sap.ui.core.HTML();
html.setContent("<iframe id='adobeTag' type='application/pdf' src='"+data+"' style='width:99%;height:100% !important;' ></iframe>");

Cheers!!!

GowthamRaja
Participant
0 Kudos

Thanks for your information Irfan. Its working fine

Answers (0)