In the future, contact anyone who finds this question through Google, like me ...
If what you want to do is find the name and contents of the annotations with a note entry. You can do it (partly based on answer from Mark)
PdfReader reader = new PdfReader(somePDF); PdfDictionary pageDict = reader.GetPageN(1); PdfArray annotArray = pageDict.GetAsArray(PdfName.ANNOTS); for (int i = 0; i < annotArray.Size; ++i) { PdfDictionary curAnnot = annotArray.GetAsDict(i); PdfString name = curAnnot.GetAsString(PdfName.T); PdfString contents = curAnnot.GetAsString(PdfName.CONTENTS); if (!string.IsNullOrWhiteSpace(name?.ToString())) { Console.WriteLine(name); } if (!string.IsNullOrWhiteSpace(contents?.ToString())) { Console.WriteLine(contents); } }
In addition, to determine what you are looking for, you can open the PDF file in a text editor and search / annotate, and you will quickly find your annotation object.
Mardoch
source share