Please, help me with this :-)

> 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 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


------------------------------------------------------------------------------
_______________________________________________
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