Skip to Content

Open PDF File in New Tab in UI5 Applicaiton on Internet Explorer

Hello Experts,

I have a requirement where i need to display PDF file in a new tab.

I have data in base 64 that i am getting from Backend into the Gateway server.( i can get in xstring format as well)

Now when i try to use-

1.  window.open("data:application/pdf," + escape(a) , "_blank");

     a will have the pdf data

   

      This works well in Chrome but fails in Internet Explorer.

What i need exactly is like webdynpro Framework where by using below we used to get pdf loaded in New tab which will have native PDF print and download options:-

  cl_wd_runtime_services=>attach_file_to_response(

*                     EXPORTING i_filename      = 'File_pdf

                      EXPORTING i_filename       = lv_file_name

                                i_content                   = lv_content

                                i_mime_type              = 'application/pdf' "

                                i_in_new_window       = abap_true

                                i_inplace                    = abap_true ).

Please let me know Guys how to achieve this functionality.I need solution that works in IE11.

Thanks in advance,

Sujit

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 31, 2015 at 04:57 PM

    Fo IE. It is user dependent.

    You can't directly control this, because it's an option controlled by Internet Explorer users.

    Opening pages using Window.open with a different window name will open in a new browser window like a popup, OR open in a new tab, if the user configured the browser to do so.

    Reference : javascript - Programmatically open new pages on Tabs - Stack Overflow

    Thanks,

    Karthik A

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Naga Prakash,

      I followed the above thread... I did not get an Error.. But MyPDF content is not visible on the page..Just the IFRAME is visible. Please tell me what could be the problem. Urgent help needed ...

      Why my PDF Content is not getting Displayed. Please tell me .. I am in serious need of some assistance.

      Error.png (111.4 kB)
  • avatar image
    Former Member
    Nov 03, 2015 at 12:11 PM

    Hi!

    You need change header paremeter 'Content-Disposition'.

    Return default value in odata method get_stream 'Content-Disposition': 'attachment', when open attach file you see dialog box Open or Download.

      METHOD /iwbep/if_mgw_appl_srv_runtime~get_stream.

    DATA: ls_header            TYPE ihttpnvp. ls_header-name = 'Content-Disposition'. IF lv_show_as_attach = abap_true. ls_header-value = 'attachment' && ';' && 'filename=' && lv_file_name && '.' && lv_doc_type. ELSE."Try this ls_header-value = 'inline' && ';' && 'filename=' && lv_file_name && '.' && lv_doc_type. ENDIF. set_header( is_header = ls_header ).

      ENDMETHOD.

    See this about Content-Disposition

    Add comment
    10|10000 characters needed characters exceeded