cancel
Showing results for 
Search instead for 
Did you mean: 

PDFAttachment API is not functioning properly

Former Member
0 Kudos

Hi,

Can u tell me if we how can we retrive attachments from the interactive form of a web dynpro application at runtime?

I am able to attach documnets to PDF form programetically but unable to retrive it.

Even i am able to successfully save entire PDF document with these attachments on local machine but unable to retrive attachments from PDF document.

I have tried 3 methods provided by API to detach attachments but seems to be none of them or working.I have tried with SP9,SP10, and base relese of SP11.

Here is code snippet.Please do let me know any body has done any thing to retrive these attachments.

IWDPDFDocumentAccessibleContext acc =WDPDFDocumentFactory.getDocumentHandler().getDocumentAccessibleContext();

acc.setPDF(wdContext.currentContextElement().getPdfSource());

pdfDoc = (IWDPDFDocument) acc.execute();

IWDPDFDocumentAttachment[] attList = pdfDoc.getAllAttachments();

//IWDPDFDocumentAttachmentList li = pdfDoc.getAttachmentList();

messageMan.reportSuccess("Processing attachments " + attList.length);

Accepted Solutions (1)

Accepted Solutions (1)

krishanu_biswas
Active Participant
0 Kudos

Hello Sudheer,

One peice of code is missing in your implementation. It should go as follows:

IWDPDFDocumentAccessibleContext acc =WDPDFDocumentFactory.getDocumentHandler().getDocumentAccessibleContext();

acc.setPDF(wdContext.currentContextElement().getPdfSource());

<b>acc.getTaskSetter().addGetAllAttachmentsTask();</b>

pdfDoc = (IWDPDFDocument) acc.execute();

IWDPDFDocumentAttachment[] attList = pdfDoc.getAllAttachments();

//IWDPDFDocumentAttachmentList li = pdfDoc.getAttachmentList();

messageMan.reportSuccess("Processing attachments " + attList.length);

The code inbetween in the bold, indicates the web dynpro framework to get the attachments attached. Without this, Web Dynpro would have tried to get the attachments

on every roundtrip even when you do not want it.

Best Regards,

Krish

Message was edited by: Krish

Krishanu Biswas

Former Member
0 Kudos

Hi,

I have the same scenario as given above. I inserted the line

getTaskSetter().addGetAllAttachmentsTask();

, as you have mentioned. But again I am getting

NoSuchMethodFound

error, now in the newly inserted line

getTaskSetter().addGetAllAttachmentsTask();

.

Please, Can you give me a solution?

Thanks,

Prabhakar.

Answers (0)