Skip to Content
0
Jul 10, 2018 at 03:39 PM

Problem PDFViewer - SAPUI5

495 Views

Hello guys,

we are having an issue with the PDFViewer control from SAPUI5.

The samples examples are quite easy to understand:

https://openui5.hana.ondemand.com/#/entity/sap.m.PDFViewer

But theses examples are all setting the source property via a file on the file system.

We are trying to load a stream coming from SAP Gateway into the PDFViewer.

Calling the service from the browser works as expected:

/xxxxxxxxxxx('63514')/$value

and loads the pdf file on the browser.

But how to load that data from the sapui5 client into the PDFViewer?

Ok it needs to have the format: "data:application/pdf;base64,XXXXXXXXXX="

Binding the view directly to /xxxxxxxxxxx('63514')/$value does not seem to work.

We are unsure if we should proceed via

oModel.read("/xxxxxx(' 63514')

or we should go via an XMLHttpRequest

( Via XMLHttpRequest we are able to open the pdf document from the ui5 client on the browser.)

But nothing really seems to work when trying to set the source property of the PDFViewer control.

Any idea? Any help will be grateful.

Thanks