Skip to Content

To view PDF in a full screen

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 29, 2017 at 08:08 AM

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

    Add comment
    10|10000 characters needed characters exceeded