cancel
Showing results for 
Search instead for 
Did you mean: 

ADS - popup pdf not scrollable

Former Member
0 Kudos

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!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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?

Former Member
0 Kudos

I want to know that you can set the url which you mentioned to the context attribute or not.

I think you can do it.

And is it not possible for you to know the PDF file path?

If the pdf file is located at server side, you are available to use my code.

Former Member
0 Kudos

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?

Former Member
0 Kudos

//@@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

}