Hi All,
I am trying to read all the annotations in the pdf file using aspose pdf 19.3 version by .net frame work.i am able to get the count as 41 but only 4 of them i can loop .please suggest me the solution to load all the comments.i am attaching the sample pdf doc i am using and code snippet.
Document pdfDocument = new Document(fileName);
StringBuilder strbannotation = new StringBuilder();
string coment = “”;
// Loop through all the annotations
for (int i = 1; i <= pdfDocument.Pages.Count; i++)
{
//AnnotationCollection annotation = (AnnotationCollection)pdfDocument.Pages[1].Annotations;
foreach (Annotation annotation in pdfDocument.Pages[i].Annotations)
{
string s = string.Format("{0} Page: {1} ; Title: {2} ; Subject : {3} ; Contents :{4} \n", coment,i, annotation is MarkupAnnotation ? ((MarkupAnnotation)annotation).Title : string.Empty,
annotation is MarkupAnnotation ? ((MarkupAnnotation)annotation).Subject : string.Empty,
annotation.Contents);
// Get annotation properties
Console.WriteLine(s);
//Console.WriteLine("Title : {0} ", annotation.FullName);
//Console.WriteLine("Subject : {0} ", annotation.Name);
//Console.WriteLine("Contents : {0} ", annotation.Contents);
// Console.WriteLine("Inreplies:{0}",annotation.)
}
}
Console.ReadLine();