Set colour of specific annotation tools  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
User avatar
MartinCS
User
Posts: 153
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Set colour of specific annotation tools

Post by MartinCS »

Hi Tracker-Team,

in the progress of my implementation of the Pdf Editor SDK you supplied me with some code in order to colourise annotation tools:

Code: Select all

int toolId = pdfCtl.Inst.Str2ID(toolIdName);
ICabNode styleParams = pdfCtl.Inst.CommentStylesManager.GetCurrentStyle(toolId);

if (styleParams == null)
{
    return;
}
styleParams["SC"].v = $"rgbd({red}, {green}, {blue})";
pdfCtl.Inst.CommentStylesManager.OnChangedCurrentStyle(toolId);
This code works perfectly, e.g. using the following inputs:
toolIdName: tool.annot.square
red: "24"
green: "40"
blue: "231"

Result view: tools_blue.zip

Unfortunately, I was not able to figure out the correct toolIds of the tools shown in attachment "tool_not_colourised.zip".

Could you tell me the correct Id names of these specific annotation tools, please?

Martin
Attachments
tool_not_colourised.zip
(4.31 KiB) Downloaded 157 times
tools_blue.zip
(4.76 KiB) Downloaded 153 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Set colour of specific annotation tools

Post by Sasha - Tracker Dev Team »

Hi MartinCS

The tools' names are:

Code: Select all

tool.annot.highlight
tool.annot.underline
tool.annot.strikeout
HTH
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
MartinCS
User
Posts: 153
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Set colour of specific annotation tools

Post by MartinCS »

Hi Sasha,

I tried to use the tool Ids you sent me. But it is not working. The colour of the dedicated tools don't change.

I do get an exception in the following code line:

Code: Select all

styleParams["SC"].v = $"rgbd({red}, {green}, {blue})";
toolIdName: "tool.annot.highlight" / (1800)
red: "24"
green: "40"
blue: "231"

Is it necessary to set a different input style param instaed of "SC" in the case of the tool Ids "tool.annot.highlight", "tool.annot.underline" and "tool.annot.strikeout"? I also tried "FC" but it didn't have an effect either.


Martin
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Set colour of specific annotation tools

Post by Sasha - Tracker Dev Team »

SC is for Stroke Color.
Highlight, strikeout and underline tools only have Fill Color so do try

Code: Select all

styleParams["FC"].v = $"rgbd({red}, {green}, {blue})";
HTH
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
MartinCS
User
Posts: 153
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Set colour of specific annotation tools

Post by MartinCS »

Hi Sasha,

it's working. :D Thank you very much!


Martin
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17941
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Set colour of specific annotation tools

Post by Tracker Supp-Stefan »

:)
Post Reply