You can iterate through the attachmentInfo.xml and look at the mimeType attribute of the child <File> element. The mimeType attribute will be the best hint you'll have of the file type. You can then save the document using the appropriate file suffix.<br />Don
I want to extract the attachement from the pdf document and display it to the attachement list of the workspace. I am using assembler service to extract the attachments.
The assembler service assigns a unique name to the document. i want to know is there a way to use the same file name as in the pdf document (for example resume.doc or passport.png). In the workspace it shows "attach-0" with no extenstion and the person has to save that file and open it with the appropriate application.
As Don pointed out, you can parse the result XML which contains information about each extracted file attachment, including the unique name created for the document, the filename that was originally associated with the document, and the content type, if it was originally provided.
The problem with using the filename for the extracted name of the document in the AssemblerResult documents map is that the filename is not guaranteed to be unique.
You can ask for the result XML without actually extracting the file attachments (extract="false"), and then use the information from the result XML to get exactly the file attachments you want.
The unique name created (the attachmentKey) actually provides information as to whether the file attachment was attached to the document in general or to a specific page, such as for a comment annotation.
The attachments.xsd schema is installed in the LC ES SDK to assist with parsing.
Here's an example result XML with one document-level and one page-level file attachment: