Set colour of specific annotation tools  SOLVED

PDF-XChange Editor SDK for Developers

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

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: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Set colour of specific annotation tools

Post by MartinCS » Wed Sep 16, 2015 5:29 am

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 64 times
tools_blue.zip
(4.76 KiB) Downloaded 69 times

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

Re: Set colour of specific annotation tools

Post by Sasha - Tracker Dev Team » Thu Sep 17, 2015 8:01 am

Hi MartinCS

The tools' names are:

Code: Select all

tool.annot.highlight
tool.annot.underline
tool.annot.strikeout
HTH
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Set colour of specific annotation tools

Post by MartinCS » Thu Sep 17, 2015 9:38 am

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

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

Re: Set colour of specific annotation tools

Post by Sasha - Tracker Dev Team » Thu Sep 17, 2015 9:55 am

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Set colour of specific annotation tools

Post by MartinCS » Thu Sep 17, 2015 3:11 pm

Hi Sasha,

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


Martin

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

Re: Set colour of specific annotation tools

Post by Tracker Supp-Stefan » Thu Sep 17, 2015 4:17 pm

:)

Post Reply