on 06-28-2006 7:44 AM
I need to get byte[] value out of IWDBusinessGraphics object. Can anyone help me?
My code:
IWDBusinessGraphics bg = (IWDBusinessGraphics) view.getElement("BusinessGraphics1");
byte[] bytImage = ???;
Hi John,
have you solved the problem ?
We have the same problem. In NW2004 we used the undocumented method
WebResourceInternal.getCachedWebResource - which is gone with nw2004s. But it still works with SP17.
public static BufferedImage getImage(IWDViewElement iBusinessGraphic ){
BufferedImage chart = null;
if( iBusinessGraphic != null && iBusinessGraphic instanceof BusinessGraphics ) {
BusinessGraphics bg = (BusinessGraphics)iBusinessGraphic;
// bg.createImage();
// bg.forceUpdate();
String url = bg.getImageSource();
String key = url.substring( url.indexOf( "~wd_key"), url.indexOf("/unknown.gif"));
try {
ICachedWebResource cacheRs = WebResourceInternal.getCachedWebResource( key );
ByteArrayOutputStream bo = new ByteArrayOutputStream();
cacheRs.writeSourceToOutputStream( bo);
chart = ImageIO.read( new ByteArrayInputStream( bo.toByteArray()) );
}catch( Exception e ) {
e.printStackTrace();
}
}
return chart;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually my code is like this:
IWDBusinessGraphics bg = (IWDBusinessGraphics) view.getElement("BusinessGraphics1");
AbstractIgsElement igs = (AbstractIgsElement) bg;
igs.createImage();
igs.forceUpdate();
String fullUrl = "forceEncoding:" + igs.getImageSource();
String encodedUrl = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).encodeRedirectURL(fullUrl);
wdContext.currentContextElement().setPdfSummSheetBgURL(encodedUrl);
com.lowagie.text.Image img = new com.lowagie.text.Image(new URL(encodedUrl));
But after I patched with SP17, the igs.getImageSource() behave differently.
Before patch, igs.getImageSource returns:
sap.session.download=1&sap-wd-cltwndid=c2&sap-wd-appwndid=Idc251b&sap-
wd-norefresh=true.
But after patched, igs.getImageSource returns
../../local/CRRSRatingWDP/CRRSRatingApp/~wd_key0_1151456666122/unknown.gif?sap.session.download=1&sap-wd-
cltwndid=d677d4e0064111db940d0003ba954bfa&sap-wd-
appwndid=Idd677d4e0064111db940d0003ba954bfa1&sap-wd-norefresh=true.
The different is, there is
no 'https://172.31.40.14:8443/webdynpro/dispatcher' at the beginning of
the URL.
Because the URL has to be pass to com.lowagie.text.Image, this change has caused an error to my application.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.