cancel
Showing results for 
Search instead for 
Did you mean: 

Problems when opening a PDF in my SAPUI5 app

Edson
Explorer
0 Kudos

Hello Experts, good day.

I have the following doubt.

We are using PDFViewer to be able to view a PDF document in a fiori app.

The problem is that when we call it, PDFViewer does not show the PDF and immediately afterward, it opens a window to download the file.

Edson_0-1713218792595.png

Edson_1-1713218890816.png

Do you know why this is happening?

This is the code I use for the PDFViewer.

 

 

                var sServiceURL = ".../ZFI_LIBRO_INV_PDF_SRV";
                var sSource = sServiceURL + "/pdfSet('" + sociedad + "," +  ejercicio + "," + perContable + "," + ledger + "," + A4Digitos +"')/$value";

                    var opdfViewer = new PDFViewer({
                        loaded: function (oEvent) {
                     }, error: function (oError) {                            
                     }, sourceValidationFailed: function (oEvent) {
                     } });
                    
                     opdfViewer.setSource(sSource);
                     opdfViewer.setTitle("Libro Inventario");
                     opdfViewer.open();  

 

 

Could it be how the PDF was created in Odata that is causing this? Or is it some particular issue about how my call was made?

Any help is welcome.

And I can't tell you how the Odata was made or so, since I don't have access to that part of the Project due to permissions issues.

Thanks so much for reading

Greetings

EBZ.



Accepted Solutions (0)

Answers (4)

Answers (4)

burakozctn
Explorer
0 Kudos

Hi, Can you share backend code please? 

Did you check mime type and file name extension?

for ex: pdf/application

for ex: XXXXX.pdf

 

Edson
Explorer
0 Kudos
Hello, Sorry, but I do not have access to the code with which the Odata was generated to obtain the PDF file, the ABAP that shared the information with me, only gave me the url, which must be filled with some parameters separated by a , to call it, it is the The only information I have, that's why I don't know, because when accessing with PDFViewer it is downloaded and not previewed.
0 Kudos

Hi Edson,
Please check the below note. 

PDFViewer Note 

subrahmanyampampana_0-1713245894049.png

 

I039810
Advisor
Advisor
0 Kudos

 

Please check the documentation for properties: displayType and isTrustedSource (sap.m.PDFViewer - API Reference - Demo Kit - SAPUI5 SDK (ondemand.com) and set it accordingly - this should solve the issue.

In case you still face issues, please create a support incident and we shall take a look

I039810
Advisor
Advisor
0 Kudos

Hi Edson

Could you share which release of SAP UI5 are you using?

From which application are you trying to open the PDF?

Thanks

Shalini

Edson
Explorer
0 Kudos
Hello Shalini. I am developing an application that generates a table, which when clicking a button, calls the odata where the PDF is hosted, when making the call, it does not appear in the PDF Viewer. The version in which I developed the app, in SAP BAS, is version 1.48 in the manifest and when I check my .yaml it appears 1.108.7
Edson
Explorer
0 Kudos
Sorry, by mistake I hit enter and my incomplete comment was generated. As I said, that is the version in which I developed or am developing the application, but I don't understand why the pdf opens that way. Thanks for your help. I look forward to your response. Greetings. EBZ