Skip to Content
0

To view PDF in a full screen

Aug 29, 2017 at 06:32 AM

42

avatar image
Former Member

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

view.jpg (18.5 kB)
controller.jpg (29.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Irfan Gokak Aug 29, 2017 at 08:08 AM
0

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!!!

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for your information Irfan. Its working fine

0