cancel
Showing results for 
Search instead for 
Did you mean: 

Window with a url

Former Member
0 Kudos

Hello,

I am trying to open a PDF in WebDynpro window. I can do it in external window like below.

window = wdComponentAPI.getWindowManager().createNonModalExternalWindow("http://mydomain.com/myform.PDF", "Pdf Browser");

window.open();

but how can i display it in same window. You may say that I can use modal window as follows

IWDWindowInfo wininfo = wdComponentAPI.getComponentInfo().findInWindows("WindowName");

IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(wininfo);

window.open();

but in this case I want to be able to use URL for modal window type. Please help me solve this issue...

thanks in advance ..

sudha

Accepted Solutions (1)

Accepted Solutions (1)

Sigiswald
Contributor
0 Kudos

Hi Sudha,

I'm not sure this what you're looking for (an external modal window or the same window?), but I'd display it in an IFrame UI element (which could be the only UI element on a Web Dynpro view). The IFrame UI element has a "Source" property which refers to the URL. If you bind it to your context you can set the value as follows:


  private void initPdf() {
    IWDResource resource =
      WDResourceFactory.createResource(
        getPdf(),
        "my-pdf-filename-without-extension",
        WDWebResourceType.PDF);
    String source =
      resource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal());
    wdContext.currentContextElement().setSource(source);
  }

where the getPdf() method returns a byte[] of the pdf file. The above allows you to create/retrieve the pdf at runtime and also generate a URL at runtime; in case you already know the URL you just need the "wdContext.currentContextElement().setSource(source);" part.

Kind regards,

Sigiswald

Former Member
0 Kudos

Hi,

I have thought of this solution but the problem I thought was they are going to remove IFrame. In API for WebDynpro the method setSource is depricated. So I thought of not using this method. But I created a context variable and then bound it to IFRame and then ser the context varialble which is ofcourse same. Yes, This is also a solution for answer. Do you know it using Windows? I will give you points though so that others who will see this thread can use the solution...:)

Sudha.

Answers (2)

Answers (2)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Sudha,

what do want to achieve exactly? Where is the PDF being stored? Do you dynamically retrieve it and then store it in the Web Dynpro Binary Cache (NW04) or create a Web Dynpro resource object out of it (NW04s)?

I described a solution for displaying a PDF document inside an Interactive Form UI element in NW04:

The solution in NW04s is the same as the new resource type cannot be applied for an Interactive Forum UI element. You still must invoke the IWDModifiableBinaryType-API combined with a context attribute of type binary.

Best regards, Bertram

Sigiswald
Contributor
0 Kudos

You're absolutely right about IFrame being deprecated

Another solution is to use the InteractiveForm UI element in PDF viewer mode (mode=usePdf), but I couldn't manage it to work without proper configuration of ADS (although I didn't spend that much time trying to figure out why).

No, unfortunately I don't know how to replace the current Web Dynpro window with some URL. If I remember it right, I think in NW2004 I once used a new non-modal window, but a modal window didn't work either (the API has a method, as you show in your code example, but it didn't work). Also in NW2004 I think it was possible to trigger an exit plug that pointed to a URL, but I'm pretty sure this ain't no longer possible in NW2004s.

As long as an IFrame is supported, it's possible to include javascript in the IFrame that can replace the Web Dynpro window. But that's not exactly a solution I would recommend...

Kind regards,

Sigiswald