on 03-09-2007 10:53 AM
I am getting a pdf document from R/3. I get the byte[] from the context node.
The num bytes returned is >0 however when I render the pdf as follows I get a black pdf document displayed and I notice that unknown.pdf the generated url.
BTW, I don't see any way to set the filename. I don't want unknown.pdf in the url.
byte[] pdfContent = wdContext.currentContextElement().getPdfDokument();
try {
IWDWebResource pdfResource = WDWebResource.getWebResource
(pdfContent, WDWebResourceType.PDF);
wdComponentAPI.getWindowManager().createExternalWindow(
pdfResource.getURL(),"Title",
false).open();
} catch (WDURLException e) {
e.printStackTrace();
}
Hi Bob,
In NW2004s we use the following. getPdf() returns a byte[], the filename is "document-<username>.pdf" and source is the attribute of an IFrame UI element.
private void initPdf() {
IWDResource resource =
WDResourceFactory.createResource(
getPdf(),
"document-"
+ WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName(),
WDWebResourceType.PDF);
String source =
resource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal());
wdContext.currentContextElement().setSource(source);
}
On NW2004 we use a FileDownload UI element (with target=_self) and we call initFileBinaryType method in the wdDoInit method. Of course you still need to set the binary PdfData context attribute with the actual content of the PDF file.
private void initFileBinaryType() {
IWDModifiableBinaryType pdf =
initFileBinaryType(IPrivateTestAppView.IContextElement.PDF_DATA);
pdf.setFileName("document-"
+ WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName());
pdf.setMimeType(WDWebResourceType.PDF);
}
private IWDModifiableBinaryType initFileBinaryType(String attribute) {
return (IWDModifiableBinaryType) wdContext
.getNodeInfo()
.getAttribute(attribute)
.getModifiableSimpleType();
}
Kind regards,
Sigiswald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bob,
If you mean by printing that the Adobe Reader toolbar containing the print button is visible, the answer is yes. That allows you to print the PDF itself.
On the other hand, if you like to print the screen of the Web Dynpro application itself (including the rendered PDF and any other rendered Web Dynpro UI elements), the answer is also yes, but it's slightly more complicated. Please check .
Kind regards,
Sigiswald
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.