on 01-17-2007 8:56 AM
Hi,
In my WebDynpro Application I want to generate a PDF (using ITEXT API's) out of the data retrieved from back end system .
I used this source code.
Document document = new Document(PageSize.A4);
document.open();
PdfPTable table = new PdfPTable(1);
PdfPCell cell;
cell = new PdfPCell(new Paragraph("ONE"));
table.addCell(cell);
cell = new PdfPCell(new Paragraph("TWO"));
table.addCell(cell);
document.add(table);
document.close();
byte[] b = new byte[100 * 1024];
b = document.toString().getBytes("UTF-8");
IWDCachedWebResource pdfRes = WDWebResource.getPublicCachedWebResource(b, WDWebResourceType.PDF, WDScopeType.CLIENTSESSION_SCOPE, wdThis.wdGetAPI().getComponent().getDeployableObjectPart(),"FileNameHelloText"));
I have used Window Manager to create a external window with the URL from pdfRes.getUrl() method.
After execution i get a pop up window with out PDF document.
Please let me know your thoughts & solutions to the above mentioned problem.
Thanks
Senthil
Hello Folks,
Use the following snippet of the code to generate PDF using ITEXT API.
Document document = new Document(PageSize.A4);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfWriter.getInstance(document, bos);
document.open();
PdfPTable table = new PdfPTable(1);
PdfPCell cell;
cell = new PdfPCell(new Paragraph("ONE"));
table.addCell(cell);
cell = new PdfPCell(new Paragraph("TWO"));
table.addCell(cell);
document.add(table);
document.close();
byte [] byteContent = bos.toByteArray();
IWDCachedWebResource cachedResource =
WDWebResource.getPublicCachedWebResource(
byteContent,
WDWebResourceType.PDF,
WDScopeType.CLIENTSESSION_SCOPE,
wdThis
.wdGetAPI()
.getComponent()
.getDeployableObjectPart(),
"TestPDF");
IWDWindow externalWindow =
wdComponentAPI
.getWindowManager()
.createExternalWindow(cachedResource.getURL(), "PDF Window",true);
externalWindow.open();
// .....
Thanks and Regards,
Gopi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There was some issues related to URL generation. I fixed it. It works now.
Thanks
Senthil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Senthil,
I'm working on the same application to generate PDF. I'm also stuck up at this point. When I write the same code that you have used, it displays application in new window without a PDF document.
You said you have URL issue and it is fixed to resolve issue.
can you kindly share what was the issue and how to resolve it? I'm also at the same point to create PDF.
Your response will be great help.
Thank you
Prasad
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.