Skip to Content

sap.m.PDFViewer Issue SAPUI5

Hi Experts

I'm trying to show a PDF File in a pop-up in SAP Web IDE (SAPUI5).

The OData service that returns the PDF File works fine.

1. When I make the call from my application, the PDF is not loaded correctly (stays in wait status), only downloads the file.

2. when I use the function read of the OData model, the response is the following:

What is the correct way to show the PDF file using the control sap.m.PDFViewer ?

If there is another way to show PDF files please indicate me.

I appreciate your help, thanks.


pdf1.png (66.7 kB)
pdf2.png (7.6 kB)
pdf3.png (31.8 kB)
pdf4.png (13.0 kB)
pdf5.png (5.7 kB)
pdf6.png (13.2 kB)
Add comment
10|10000 characters needed characters exceeded

3 Answers

  • Posted on Feb 13, 2019 at 11:54 PM


    I got the same issue and, in my case, it was because I didn't specify any HTTP Header parameters in my backend method GET_STREAM.
    So the default behaviour was to download directly the file rather than display it in sap.m.PDFViewer.

    It was solved by adding this ABAP code in method GET_STREAM:
    DATA http_header TYPE ihttpnvp.
    http_header-name = 'Content-Disposition'.
    http_header-value = 'inline; filename="MyPDF.pdf";'.
    set_header( is_header = http_header ).


    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 10, 2018 at 03:21 PM

    Hi Augusto,

    the examples you are refering to concern loading files from the file system. That was not the question. How can we load stream content into the PdfViewer contro from sapui5?


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jordi,

      have you found any answer to your issue?

      I am facing the same problem.

      The templates for the PDF Viewer don't help at all when you try do show a PDF, from archive for example.

      Best regards,


  • Posted on Mar 21, 2018 at 11:37 PM

    Hi Juan

    You can find 3 examples of PDF Viewer on this link:

    For all the examples, you can see and download the code. Just click on the example and then there will be a button on the top right "show source code for this example".



    Add comment
    10|10000 characters needed characters exceeded