Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Annotations

$
0
0
Hello

We are using aspose pdf 9.5.0 to get all the annotations of a page and get the highlighted text.
It is working great on most of the pdf file, but not in the attached one.
I am not able to get the text of the annotations inside a table (see attached file)
The code is :
AnnotationCollection annots = page.getAnnotations();
        for (int j = 1; j <= annots.size(); j++) {
            com.aspose.pdf.Annotation annot = annots.get_Item(j);
            if (annot instanceof HighlightAnnotation){
                HighlightAnnotation linkAnno = (HighlightAnnotation)annot;
                com.aspose.pdf.Rectangle rect = linkAnno.getRect();
                if (annot.getName() != null) {
                    TextAbsorber absorber = new TextAbsorber();
                    absorber.getTextSearchOptions().setLimitToPageBounds(true);
                    absorber.getTextSearchOptions().setRectangle(rect);
                    page.accept(absorber);
                    String text = absorber.getText();
                    System.out.println(text);
                }
            }
        }

This code is returning the text of the annotation named TITLE, but it is returning empty value for the annotations named BON and COMPTE.

Can you advise please,
Thank you,
karine

Viewing all articles
Browse latest Browse all 3131

Trending Articles