on 12-14-2007 9:01 AM
Hi,
First let me explain my scenario:
I have to get the <b>attachments in a PDF document</b>, using a <b>java program</b>. I am using Java perspective of NWDS. I am using the APIs
->IWDPDFDocumentHandler
->IWDPDFDocumentAccessibleContext
->IWDPDFDocument
->IWDPDFDocumentAttachment
in my program.
When I run my java program, I am getting the <b>java.lang.NoClassDefFoundError</b>. Can you please, give me a solution for this problem?
Note : I have added the necessary JAR files to the project.
Thanks,
Prabhakar.
Hi Prabhakar,
Can u send the complete stack trace. where exactly u r getting this problem??
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sumit,
Here is the result which I got in the console,
java.lang.NoClassDefFoundError: com/sap/tc/webdynpro/services/exceptions/WDRuntimeException
at PDFAttachment.readAttachmentFromPDF(PDFAttachment.java:241)
at PDFAttachmentMain.main(PDFAttachmentMain.java:21)
Exception in thread "main"
Note :
PDFAttachment
- Class
readAttachmentFromPDF
- method
The code is,
String PDFDocName = "podetailswithAttachment.pdf";
//wdComponentAPI.getMessageManager().reportSuccess("Outside try FileName :"+PDFDocName );
try
{
//wdComponentAPI.getMessageManager().reportSuccess("Inside try FileName :"+PDFDocName );
FileInputStream fileInpStrm = new FileInputStream("C:\"+PDFDocName);
FileOutputStream fileOutStrm;// = new FileOutputStream()
ByteArrayOutputStream bo = new ByteArrayOutputStream();
int c;
while ((c = fileInpStrm.read()) > -1)
{
bo.write(c);
}
byte[] pdfSource = bo.toByteArray();
// Line :240
IWDPDFDocumentHandler pdfdocHandler =WDPDFDocumentFactory.getDocumentHandler();
IWDPDFDocumentAccessibleContext pdfdocaccContext = pdfdocHandler.getDocumentAccessibleContext();
pdfdocaccContext.setPDF(bo);
IWDPDFDocument pdfDocument = pdfdocaccContext.execute();
IWDPDFDocumentAttachment[] pdfatt = pdfDocument.getAllAttachments();
//wdComponentAPI.getMessageManager().reportSuccess("Length of the attachments: "+pdfatt.length);
//pdfdocaccContext.setPDF();
}
catch(Exception e)
{
//wdComponentAPI.getMessageManager().reportSuccess(""+e);
System.out.println(""+e);
}
Thanks,
Prabhakar.
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.