Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

cannot able to use iframe

Hi,

In my application, i pleace ifram and bind to a context attribute of type string.

created a model with export parameter of type xstring. now i wanna convert this xstring to string and dispaly pdf in iframe.

i used below code to convert xstringtostring

String url = "";

WDWebResourceType webResType = WDWebResourceType.PDF;

IWDWebResource webResource = WDWebResource.getWebResource(doc_content, webResType);

try {

url = webResource.getURL();

} catch (WDURLException e) {

e.printStackTrace();

}

return url;

but its throgunig null pointer exception

when i use below code without iframe, i can see the pdf which is opening in external window

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); }

but i dont want to open in external window. how to do dat

Former Member replied

Hi Venkat,

Try like this:

Comment the below code

try {

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

}

catch (WDURLException e)

Create a context attribute url

wdContext.currentContextElement().setURL(pdfResource.getURL());

Create IFrame UI Element. Bind its source property with this url.

source url

Regards,

Siva

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question