Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

attachments extraction.

AmbikaM
Level 4
Level 4
hi all,



my pdf with attachments is working perfectly but the thing is that , when i try to extract the attachments and save it to the local drive , it gets saved as unknown file type. how to extract the attachments.please help...



thanks in advance.
1 Reply
AmbikaM
Level 4
Level 4
hi ,



im extracting the attachments using the following code,



...

List Attachments = result.getAttachments();

//Create an Iterator object and iterate through

//the List object

System.out.println("before check of attachments");

Iterator iter = Attachments.iterator();

int i = 0 ;

while (iter.hasNext()) {

//String fileName=Attachments.listIterator(0).toString();

//System.out.println("filename"+fileName);

Document file = (Document)iter.next();

file.copyToFile(new File("D:\\temp\\attachments"+i+""));

i++;

..



the attachments are of type, pdf, text ,jpeg etc... so how should i save the attachments to the drive. kindly help as im very new to this.