cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 PDFViewer Not Working : Underlying iframe was not found in DOM.

YouriC
Participant
0 Kudos
428

Hi all,

I'm currently working on a SAPUI5 application that needs to display a PDF from the ABAP backend.

The OData Service is OK. Tests with Gateway Client are positive.
Just one point : I had to adapt the content-disposition to pass ‘inline’ instead of 'attachment' on ABAP system (SEGW)
>>> In order to display my PDF in the SAPUI5 application and no longer download it.

Now, I'm encountering another error in my SAPUI5 application
>>> FYI My SAPUI5 Version is "1.120.0"

The PDFViewer say "The PDF file could not be loaded."
And in the console I see the error message "Underlying iframe was not found in DOM."
My OData request is OK. The problem seems to be with my SAPUI5 application.

The code is relatively basic.
A PDFViewer on a view with setSource and setVisible, I also tried with Open method but same error.

I found the SAP Note https://me.sap.com/notes/3429273/E but the properties "isTrustedSource" does not seem to be available with my version of SAPUI5 ("1.120.0").

I also tested my application with SAPUI5 version"1.120.20" on SAP BAS, In this case, I receive the message "Download the file to view it".
>>> Downloading works well, but that's not the purpose of the application.

How can I display the PDF content directly in the application?
In my case, downloading is not an option ...

Thanks in advance for your help.
YouriC

YouriC
Participant
0 Kudos

Just for information, I've just tried my application on EDGE and the PDF is displayed correctly...

So the problem is mainly on Chrome?

Any idea why ?

View Entire Topic
WouterLemaire
Active Contributor
0 Kudos

Edge and Chrome are based on the same engine, in most cases it works in chrome and not in edge 🙂 . Nevertheless, how do you set the url for OData request in the pdfviewer? Do you use binding or do you set it via the controller?

I would also recommend to use the latest patch as you already tried.

Have you tried with another pdf?

Can you share a code snippet?

WouterLemaire
Active Contributor
0 Kudos
Alternative, you can try adding an IFrame and set the url of the PDF as the source url. Should also do the trick.
YouriC
Participant
0 Kudos

Hi @WouterLemaire,

In the end, I tested on another computer with CHROME and there was no problem.
So the problem seemed to come from my own CHROME.

However, in my CHROME my settings were OK.
I've reset the "chrome://settings/content/pdfDocuments" and after that the problem was solved.

For the point with the IFrame I tried and it was OK but I wanted to do it with the PDFViewer.
I wanted to stay with something standard.

Thanks for your feedback 😉
YouriC