Can't extract highlighted text

Hello sir

I’m trying to extract highlighted text.
You can see Yellow highlighted text in my pdf.

HIGHLIGHT TEST.pdf (3.4 KB)

I want to get text “TEST1” and “TEST2” but
getMaredText and GetMarkedTextFragments doesn’t work.
Let me know how to solve this problem and have a nice day~

  • here is my code
    foreach (var p in pages)
    {
    foreach (Annotation ann in p.Annotations)
    {
    if(ann.AnnotationType == AnnotationType.Highlight)
    {
    HighlightAnnotation highlightAnnotation = ann as HighlightAnnotation;

                      string b = highlightAnnotation.GetMarkedText();
                      TextFragmentCollection collection =  highlightAnnotation.GetMarkedTextFragments();
                      string text = string.Empty;
                      foreach(TextFragment tf in collection)
                      {
                          text += tf.Text;
                      }
                      string a = "a";
    
              }
      }
    

}

@yeonkyu

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as PDFNET-51583. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNET-51583) have been fixed in Aspose.PDF for .NET 22.10.