on 06-11-2009 11:57 AM
Hi All,
I am tring to upload the data from WD Java to PDF using iText API, which I saw in an article by Ayyappa Raj . Below is the code i am using. it is opening a poup and then starting the adobe reader after that I am getting an empty screen. No data is getting displayed.
Document document = null;
PdfWriter writer = null;
//IWDResource resource = null;
ByteArrayOutputStream outputStream = null;
try
{
document = new Document(PageSize. A4, 50, 50, 50, 50);
outputStream = new ByteArrayOutputStream();
writer = PdfWriter. getInstance(document, outputStream);
PdfWriter.getInstance(document, outputStream);
document.open();
document.add(new Paragraph("Hello We Created a PDF File"));
document.add(new Paragraph(new Date(System.currentTimeMillis()).toString()));
byte[] html=new byte[4096];
html=outputStream.toByteArray();
document.close();
writer.close();
IWDWindow win =wdThis.wdGetAPI().getComponent().getWindowManager()
.createNonModalExternalWindow(WDResourceFactory.createCachedResource(html,"PDF File", WDWebResourceType.PDF)
.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()),"PDF File");
win.setWindowSize(600,600);
win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
win.removeWindowFeature(WDWindowFeature.MENU_BAR);
win.show();
outputStream.close();
} catch (Exception e) {
wdComponentAPI.getMessageManager().reportException("Exception::"+e,false);
}
Please help, where I am doing the mistake?
Regards,
SrinivaS
I am not sure though,but I would ask you try writing the following close statements after showing the pop up window
document.close();
writer.close();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Any help???
Regards,
SrinivaS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.