Hi,

I am embedding a document level file using the itext code below. However, I
cannot delete it. May I know the code to delete them?



        
                public void addAttachments(
                                  String src, String dest, String[] 
attachments) throws IOException,
DocumentException {
                                  PdfReader reader = new PdfReader(src);
                                  PdfStamper stamper = new PdfStamper(reader, 
new
FileOutputStream(dest));
                                  for (int i = 0; i < attachments.length; i++) {
                                    addAttachment(stamper.getWriter(), new 
File(attachments[i]));
                                  }
                                  stamper.close();
                                }

                                protected void addAttachment(PdfWriter writer, 
File src) throws
IOException {
                                  PdfFileSpecification fs =
                                    PdfFileSpecification.fileEmbedded(writer, 
src.getAbsolutePath(),
src.getName(), null);
                                  
writer.addFileAttachment(src.getName().substring(0,
src.getName().indexOf('.')), fs);
                                }
                }
                
                







Thanks,
Regards,
Brian



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/How-to-delete-document-level-file-from-pdf-tp4660517.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to