Hi,
When the document has loaded, I access the reader control's toolModeMap and "inject" red as the default StrokeColor for the AnnotationCreateTextHighlight ToolMode.
readerControl.toolModeMap['AnnotationCreateTextHighlight'].defaults.StrokeColor = { R: 255, G: 0, B: 0, A:1};
I have taken this approach from the function handleAnnotationCreate in AnnotationEdit.js (Line 1038).
I am using this approach in order to define the default text highlight color and I have found this to work with the Text Highlight Annotation Tool.
However when I select text with the Cursor Arrow and then click on "Highlight Text" in the opened context menu a different color will be used.
This is suprising as the same code is executed as with using the Text Highlight tool directly. During debug I find that
annotTool.defaults.StrokeColor
in
textAnnot.StrokeColor = annotTool.defaults.StrokeColor; (Line 1049 of AnnotationEdit.js)
actually returns my color preference but
textAnnot.StrokeColor
somehow is not correctly setting the annotation's color.
Can you please check this issue?
Please let me know if there is a better way to setting the TextHighlight Annotations default color for ALL ways that allow adding a text hightlight.
This (https://www.pdftron.com/documentation/web/guides/basics/annotations/customizing-tools) does not work for me as it only changes the color when using the TextHighlight Annotation Tool directly.
Also I do not want to have the same color always. I just would like to have a different default color.
Kind regards,
Thorsten