Good evening,
I am trying to extract the annotations in a pdf file. This is straight forward: reader = new PdfReader(pdfFile.fullname); for (int n = 1; n <= reader.NumberOfPages; n++) { PdfDictionary page = reader.GetPageN(n); PdfArray annotsArray = page.GetAsArray(PdfName.ANNOTS); if (annotsArray != null) { for (int k = 0; k < annotsArray.Size; k++) { PdfDictionary annot = (PdfDictionary)PdfReader.GetPdfObject(annotsArray[k]); PdfString content = (PdfString)PdfReader.GetPdfObject(annot.Get(PdfName.CONTENTS)); if (content != null) { System.Windows.Forms.MessageBox.Show(content.ToString()); } } } } However, if the annotation contains Unicode (more specific 1252 code page) the annotation is not read correctly. I tried modifying the above code as follows: if (content != null) { byte[] byteArray = Encoding.Unicode.GetBytes(((PdfString)PdfReader.GetPdfObject(annot.Get(PdfNa me.CONTENTS))).ToString()); string s = Encoding.Unicode.GetString(byteArray); System.Windows.Forms.MessageBox.Show(s); Unfortunately, this does not resolve the issue. I have attached a sample file with the troublesome annotation. I was wondering if someone could point me in the right direction. Thanks. William Bell
mypd1f.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________ 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