At a guess, I'd say you're dealing with embedded videos and such rather than File Attachments (as defined by PDF).
Could we see your PDF? --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; Disclaimer<Cardiff> DisCard = null; > -----Original Message----- > From: r00fus [mailto:[email protected]] > Sent: Monday, May 10, 2010 2:03 PM > To: [email protected] > Subject: [iText-questions] Remove pdf attachments > > > Hi, > I'm new to this list but have a question which I don't think > has been resolved here in my searches through the archives. > > I'm trying to remove attachments from a number of my pdf > files (I can extract via pdftk, so preserving them is not an issue). > > I found the following example code on the mailing list from a > http://old.nabble.com/Remove-Attachments-from-pdf-file-td22804697.html > previous thread : > 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(); > } > } > } > However, the code does not work. In my introspection of > the code, I only > found that the variable "names" is null. On further > examination, even "catalog.get(PdfName.NAMES)" shows null on > a System.out.println(). > > Before I spend days diving deep into the itext library and > PDF spec, I was wondering if someone could help me in > figuring out what I can do to get this working. > > Thanks in advance! > > > -- > View this message in context: > http://itext-general.2136553.n4.nabble.com/Remove-pdf-attachme nts-tp2172927p2172927.html > Sent from the iText - General mailing list archive at Nabble.com. > > -------------------------------------------------------------- > ---------------- > > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.itextpdf.com/book/ Check the > site with examples before you ask questions: > http://www.1t3xt.info/examples/ You can also search the > keywords list: http://1t3xt.info/tutorials/keywords/ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 9.0.814 / Virus Database: 271.1.1/2842 - Release > Date: 05/10/10 23:26:00 > ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
