cancel
Showing results for 
Search instead for 
Did you mean: 

Open PDF directly in WD

Former Member
0 Kudos

Hello,

my purpose is to open a pdf file directly without getting a dialog box. How can i do that? Until now i used the following code:


	IWDWindow newwindow = wdComponentAPI.getWindowManager().
		createExternalWindow(mainUrl2,"Document Preview",false);
	newwindow.open();    

The pdf is not stored local. I get the url from the Web As.

regards,

sharam

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sharam,

if you use FileDownload you always will get the open/save dialog, if you want to display the pdf in your view you could use IFrame, but you should not, because IFrame is deprecated. So do as Bertram suggests in the thread I mentioned before.

Kind Regards

Stefanie

Former Member
0 Kudos

Hi Stefanie,

you are right, if I use the FileDownload I will get always the open/save dialog. Ok, I can live with it. But after the open/save Dialog I get an another Dialog with the message:

Windows can not open this file.

(Radio Buttons)

- Use the Web Service to find the appropriate Program

- Select the program from a list

I think the problem is that I opened the file from a Server, so there is no extension with .pdf in my url. Is there a way to solve this problem?

regards,

Sharam

P.S.: I can not use Interactive Forms

url:

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Sharam,

what's your SAP NetWeaver release? SAP NetWeaver 04 or 04s? Within SAP NW 04s there is the possibility to open a downloaded file "in place":

You can dynamically set the behavior property of the FileDownload-UI-element. The enumeration type WDFileDownloadBehaviour determines how the downloaded file is represented on the client. This property can have three different values:

  • <b>AUTO</b>: The behaviour is predefined and depends on the mime type of the downloaded file.

  • <b>ALLOW_SAVE</b>: An open/save dialog asks the user.

  • <b>OPEN_INPLACE</b>: The file will be opened in place in the web page with the browser-embedded application program.

Now to your second problem: "Windows cannot open this file". This is based on the fact that you do not correctly set the MIME type of the uploaded resource within the MofifiableBinaryType metadata (attribute info) of the context attribute storing the byte array. Or when you develop in NW04s you did not correctly set this MIME type within the resource object of type IWDResource.

Best regards, Bertram

Former Member
0 Kudos

Hi Betram,

thanks for your replay, I will give you 10 Points. Can you please answer me a last question. How can I set the mime type when I use Netweaver 04? Could you please post me a exemple?

regards,

Sharam

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sharam,

your question is answered within my <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/d2201c20-0801-0010-49b3-94fca8f590d5">file Up/Download Tutorial for NW04</a>.

Regards, Bertram

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sharam,

see this thread:

Especially Bertram's post (-;

Kind Regards

Stefanie

Former Member
0 Kudos

Hi Stefanie,

how can I use the following code, if I have to get my document from the Web As. The location of my pdf file is:

url:http://testSystem:1009/sap/bc/contentserver/800?get&pVersion=0046&contRep=L1&docId=E04B5F341751CE4399B1B91738F5D02A

So i can not use the following code:


	pdfUrl =
		WDWebResource
			.getWebResource(wdComponentAPI.getDeployableObjectPart(), WDWebResourceType.PDF, "<pdf file name>.pdf")
			.getURL();

If I bind my url directly to the context of my ui I get the window dialog box and that is not my purpose.

Thanks for your replay.

regards,

Sharam

Former Member
0 Kudos

Hi.

<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/c8/32cc6922fb6040a768652aaa0b6879/frameset.htm">File Download API with usage options</a>

Regards

Bharathwaj

Former Member
0 Kudos

Hello Bharathwaj,

i try the File Download API (simple standard), but i get always the dialog box. Is there any way to get the pdf directly without the dialog box?

regards,

sharam