hi, > Date: Fri, 25 Mar 2011 17:14:03 +0530 > From: s.selvaku...@spi-global.com > To: itext-questions@lists.sourceforge.net > Subject: [iText-questions] Attchment extracttion issue > > Hi All, > > I have tried to extract attachment from pdf and it throws null for the > attached pdf. This happens only for Acrobat Distiller profile and no > issue in other file types.
successfully extracted the attachment from your PDF using iTextSharp 5.0.6: PdfReader reader = new PdfReader(PATH_TO_PDF); PdfDictionary root = reader.Catalog; PdfDictionary documentnames = root.GetAsDict(PdfName.NAMES); PdfDictionary embeddedfiles = documentnames.GetAsDict(PdfName.EMBEDDEDFILES); PdfArray filespecs = embeddedfiles.GetAsArray(PdfName.NAMES); string name = ""; for (int i = 0; i < filespecs.Size; ) { filespecs.GetAsString(i++); PdfDictionary filespec = filespecs.GetAsDict(i++); PdfDictionary refs = filespec.GetAsDict(PdfName.EF); foreach (PdfName key in refs.Keys) { PRStream stream = (PRStream) PdfReader.GetPdfObject( refs.GetAsIndirectObject(key) ); attachments.Add( filespec.GetAsString(key).ToString(), PdfReader.GetStreamBytes(stream) ); name = filespec.GetAsString(key).ToString(); } } your code looks almost the same above - are you using 5.0.6 too? ------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ 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