The trick to this is in the results that the DDX returns. When using the FileAttachments tag in a DDX the result is not just the attachments, but also an XML that describes the attachments.
The description file (identified using the “result” attribute in the DDX) goes into a Map stored in AssemblerResult.object.documents. The extracted documents are also stored in this map.
By reading the description XML file you can tell the file name, content type and location (key) of the attachments. A simple loop is used to read the XML file, find the attachments (by the key in the Map) and write them to the file system.
Thank you so much for your help..
I have one more requirement :
A PDF has multiple subforms(same instance being added) and that subform contains an attach file button.
Now I want to extract these attachments in the subform level rather than form level because i want to write each subform files in separate folders.
Is this Possible?
Note: i have an another field in that subform which is having a unique value along with attach file button inorder to distinguish the subforms.
Hope I am clear.
AFAIK Acrobat only has one location to store attachments. Although the subforms may each have an attachment button, the attachments are all going to the same place in the PDF.
If you need to identify what attachments are in what subform you may need to add an identifier to the attachment by using either the attachment name or description. For example you may tag all the attachments with the sub form name as the description.
can you be more specific regarding the description of the attachment. how to add the description to the files in the same subform?
And also, Can i change the name of the attachment to our convinience after the user has attached any file?