Skip to Content
author's profile photo Former Member
Former Member

Converting Xstring output of RFC to the PDF format

Hi,

1. I have created one web dynpro application, in which i am accessing rfc function.

2. Rfc function's output is XString type (Smart form).

3. In web dynpro i am using the following code to display the same.

byte[] text = null;

text = wdContext.currentOutputElement().getBin_File();

wdContext.currentContextElement().setCtx_va_att(convertXStringToUrl(text));

public static String convertXStringToUrl(byte[] docContent)

{

String url = "";

WDWebResourceType resourceType = WDWebResourceType.PDF;

IWDWebResource webResource = WDWebResource.getWebResource(docContent,resourceType);

try {

url = webResource.getURL();

} catch (WDURLException e) {

// TODO Auto-generated catch block

url = e.getMessage();

return url;

}

return url;

}

4.I am setting this url to Source attribute of iFrame.

5. But in the output, it displays only the empty iFrame component.

6. I am using ep6 & netweaver ver 7.0.09

7. Also tried using WebCacheResource. It opens the Acrobat reader but displays error File does not start with '%PDF'.

7. What could be the error?

Thanks in advance,

Nilesh

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 02, 2009 at 04:56 AM

    Hi Nilesh,

    You can use this code:

    
    public static String convertXStringToUrl()
    {
    String url = "";
    
    IWDCachedWebResource l_file = WDWebResource.getWebResource(wdContext.currentOutputElement().getBin_File(),WDWebResourceType.PDF);
    
    try {
    url =  l_file.getAbsoluteURL()
    } catch (WDURLException e) {
    // TODO Auto-generated catch block
    url = e.getMessage();
    return url;
    }
    
    return url;
    }
    

    Please Note: The important change made is use of IWDCachedWebResource and the URL has to be absoluteURL.

    This should definetely solve your problem as i have gone through this once and followed this approach.

    -Kunal Kotak

    Edited by: kunal kotak on Jan 2, 2009 10:30 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 02, 2009 at 09:48 AM

    Hi Nilesh,

    Please check the Acrobat Reader is properly installed and its version and try the following code,

    byte[] pdfContent = wdContext.currentXtstingElement().getE_Xstring();

    String pdfFileName = "Test";

    WDDeployableObjectPart objpart=wdThis.wdGetAPI().getComponent().getDeployableObjectPart();

    IWDCachedWebResource pdfResource= WDWebResource.getPublicCachedWebResource(pdfContent,WDWebResourceType.PDF,WDScopeType.APPLICATION_SCOPE,objpart,"Page1");

    try {

    wdComponentAPI.getWindowManager().createNonModalExternalWindow(pdfResource.getURL(),pdfFileName).show();

    }

    catch (WDURLException e)

    { wdComponentAPI.getMessageManager().reportException(e.getMessage(),false); }

    Regards,

    Suresh T

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2009 at 05:35 AM

    Thanks a lot.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.