We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Misaligned annotation issue

Hi.
We have a issue with text annotation. When we added highlight annotation to the PDF document, it is offset from the original text (see attached screen).
image.png (12.2 KB)
Could you, pls, describe the reason why?

Java code snippet

@Test
void addAnnotationTest(){
var document = new Document(“Pages.pdf”);
var page = document.getPages().get_Item(1);
var absorber = new TextFragmentAbsorber();
absorber.setPhrase(“01Nov2017”);
page.accept(absorber);
var textFragment = absorber.getTextFragments().get_Item(1);
var annotation = new HighlightAnnotation(page, textFragment.getRectangle());
page.getAnnotations().add(annotation);
document.save(“result.pdf”);
}

Pages.pdf (429.0 KB)

@dkuksa

A ticket with ID PDFJAVA-40999 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.