on 06-12-2007 10:32 PM
We're trying to render SMARTFORMS outpur as PDF within our WebDynpro
application. We've found several posts which have been very helpful
and I think we're close. When we try to show the pdf a client browser window
is spawned and the content is rendered as text within the browser (shown below).
It looks like I'm not setting the content-type in the response header correctly.
Below is the code we're using.
Much Thanks,
Greg
/* Code used to launch browser and view PDF */
String file_prefix = "rfq";
IWDCachedWebResource pdfResource = WDWebResource.getPublicCachedWebResource(
pdfContent, WDWebResourceType.PDF, WDScopeType.CLIENTSESSION_SCOPE,
wdThis.wdGetAPI().getComponent().getDeployableObjectPart(),
file_prefix );
wdComponentAPI.getWindowManager().createExternalWindow( pdfResource.getURL(), "RFQ", false).open();
/* First few lines of rendered document */
DF-1.3
%âãÏÓ
2 0 obj
<<
/Type /FontDescriptor
/Ascent 720
/CapHeight 660
/Descent -270
/Flags 34
/FontBBox [-177 -269 1123 6]
/FontName /Times-Roman
/ItalicAngle 0
/StemV 105
>>
This was resolved. We truncated some of the formatting/header info during the conversion.
Thanks,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a separate view to display PDF.
Create a frame on that view and attach its datasource to url.
Please go through the following code.
The return value URL should be used as source for Frame.
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;
} else if (doc_type.equals("HTML")){
webResType = WDWebResourceType.HTML;
} else if (doc_type.equals("XML")) {
webResType = WDWebResourceType.XML;
} else {
try {
fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(), "WrongDocType", "text", wdThis.wdGetAPI().getTextAccessor().getText("WrongDocType", new String[] { doc_type }));
} catch(FPMRuntimeException ex) {
;
}
}
IWDWebResource webResource = WDWebResource.getWebResource(doc_content, webResType);
// IWDWebResource webResource = WDWebResource.getWebResource(doc_content, webResType, false);
try {
url = webResource.getURL();
}
catch (WDURLException ex) {
try {
fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(), ex);
} catch(FPMRuntimeException ex2) {
;
}
}
} else {
/** Todo: Error! */
}
return (url);
}
Hope this helps you.
Regards,
Nagaraju Donikena
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 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.