on 12-08-2004 12:06 PM
When i used ADS to generate an embedded PDF within a Webdynpro screen, the embedded PDF is scrollable.
But if I pop the PDF onto a PDF on it's own that is not embedded in a Webdynpro view, the PDF won't have scrolling, pressing the print button abilities etc!
we've considered that method but the createExternalWindow() method requires the URL of the pdf. But our pdf's URL is dynamic coz it's generated on the fly. So far, we've been unable to get the PDF's url.
Any other ideas? Or is this another bug that needs to be fixed?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
An SAP developer suggested that I change the property in the following code from true to false :
IWDWindowInfo windowInfo = (IWDWindowInfo) wdThis.wdGetAPI().getComponent().getComponentInfo().findInWindows("DisplayPDFSummSheetWindow");
IWDWindow window = wdThis.wdGetAPI().getComponent().getWindowManager().createWindow(windowInfo, false);
wdContext.currentPopupElement().setWindowInstance( window );
window.setWindowSize( 800, 600 );
window.setWindowPosition(50, 50);
window.open();
STILL DOESN'T WORK.
Would loading the PDF in another separate browser window solve the problem?
The method createExternalWindow requires an URL for the PDF. How do I get the PDF's URL?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
//@@begin javadoc:onActionOpenWidow(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionOpenWidow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionOpenWidow(ServerEvent)
String fileName = "C:
FileLocation
DH11_test.pdf";
String fileUrl;
try {
File file = new File(fileName);
FileInputStream in = new FileInputStream(file);
ByteArrayOutputStream out = new ByteArrayOutputStream();
int length;
byte[] part = new byte[10 * 1024];
while ((length = in.read(part)) != -1) {
out.write(part, 0, length);
}
in.close();
fileUrl = this.convertXstringToUrl(out.toByteArray(), "PDF");
} catch (Exception e) {
throw new WDRuntimeException(e);
}
IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(fileUrl, "View File", true);
window.open();
//@@end
}
/*
The following code section can be used for any Java code that is
not to be visible to other controllers/views or that contains constructs
currently not supported directly by Web Dynpro (such as inner classes or
member variables etc.). </p>
*
Note: The content of this section is in no way managed/controlled
by the Web Dynpro Designtime or the Web Dynpro Runtime.
*/
//@@begin others
private String convertXstringToUrl(
byte[] doc_content,
java.lang.String doc_type) {
// setIFrameUrl()
String url = "";
if (doc_content != null && doc_content.length != 0) {
MessageManager msgMgr;
WDWebResourceType webResType = WDWebResourceType.PDF;
if (doc_type.equals("PDF")) {
webResType = WDWebResourceType.PDF;
}
IWDWebResource webResource =
WDWebResource.getWebResource(doc_content, webResType);
try {
url = webResource.getURL();
} catch (WDURLException ex) {
IWDMessageManager msg = wdComponentAPI.getMessageManager();
msg.reportMessage(
IMessageFileDowunLoadApp.SERVERSIDE_ERROR,
null,
false);
}
} else {
/** Todo: Error! */
}
return (url);
}
//@@end
}
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.