Set the color of a text annotation before creating it

46 views
Skip to first unread message

Matt Parizeau

unread,
Aug 19, 2014, 7:11:55 PM8/19/14
to pdfnet-w...@googlegroups.com
Q:

With non-text annotations I can set the defaultFillColor or defaultStrokeColor to set the colors before creating them. Is it possible to set the color of a text annotation before it's created?

A:

You can do this by overriding the text annotation tools:
$(document).on('viewerLoaded', function() {
   
var oldLeftDown = Tools.TextHighlightCreateTool.prototype.mouseLeftDown;
   
Tools.TextHighlightCreateTool.prototype.mouseLeftDown = function() {
        oldLeftDown
.apply(this, arguments);
       
this.annotation.StrokeColor = new Annotations.Color(0, 255, 255);
   
};
});

Reply all
Reply to author
Forward
0 new messages