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

Free Support Forum - groupdocs.com

Watermark and text field lose their content after applying other annotations

Watermark and text field lose their content after applying other annotations.

Files: watermark-lose-content.7z (191.7 KB)
Git project: https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-Java
Git branch: master
Git revision: aeb3d5d9
Browser: Chrome Version 92.0.4515.159 (Official Build) (64-bit)
SO: Windows 10
Java version: 1.8.0_281
watermark-lose-content.7z (192 KB)

@john.mcqueide

This issue is under investigation with ticket ID ANNOTATIONJAVA-1336.

1 Like

@vitaliy.rezchikov

I figure out the issue cause in AnnotationMapper class, when it tries to get annotation text it didn`t check when the annotation if of the type IText, so just add new clause.

public class AnnotationMapper {
    ...
    public static AnnotationDataEntity mapAnnotationDataEntity(AnnotationBase annotationInfo, PageInfo pageInfo) {
        ...
        String text = "";
        if (annotationInfo.getMessage() == null && annotationInfo instanceof ITextToReplace) {
            text = ((ITextToReplace) annotationInfo).getTextToReplace();
        //NEW CODE
        } else if (annotationInfo instanceof IText && ((IText) annotationInfo).getText() != null) {
            text = ((IText) annotationInfo).getText();
        }else if (annotationInfo.getMessage() != null) {
            text = annotationInfo.getMessage();
        }
        annotation.setText(text);
        ...
    }
}
1 Like

@john.mcqueide

Good to know that the issue is resolved.