Hello.

Maybe you can help with a problem i'm having...


With itext i can add attachments to a pdf file and i can also extract
them. However i didn't find a way to remove them from the file, i mean,
i want to delete the attachments of a pdf file so that the file becames
"clean", without attachments but with all the other elements,like text
and images.

I searched, but i only found "ideas" and a code snippet:

public void removeAttachments(PdfReader reader) {   PdfDictionary
catalog = reader.getCatalog();   PdfDictionary names = (PdfDictionary)
PdfReader.getPdfObject(catalog.get(PdfName.NAMES));   if( names != null
)   {      PdfDictionary files = (PdfDictionary)
PdfReader.getPdfObject(names.get(PdfName.EMBEDDEDFILES));      if( files
!= null )      {         for( Object key : files.getKeys() )         {
           files.remove((PdfName)key);         }
        reader.removeUnusedObjects();
     }   } }


but nothing happens when i use this. I used this with the code avaiable
on the itext toolbox to extract attachments.

please help me!



------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to