JS property 'strokeColor' not working  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:

JS property 'strokeColor' not working

Post by MartinCS »

Hi Tracker-Team,

my purpose is to create an annotation via JavaScript with the following code:

Code: Select all

var annot = this.addAnnot({
type: "FreeText",
author: "John Doe",
width: 0,
page: 0,
strokeColor: ['RGB',0,0,0],
fillColor: color.transparent,
textFont: "Arial",
textSize: 7.09,
rect: [28.39,115.87,510.28,124.72],
rotate: 0,
contents: "sample text",
alignment: 0,
readOnly: true});
But the property 'strokeColor' can't not be set. It's always red regardless which value I set, e.g.

Code: Select all

strokeColor: ['RGB',0,1,0],
I'm able to reproduce this issue in the standalone Editor via the JavaScript Console as well;
12-01-_2018_15-57-20.jpg
I hope you guys can help!

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

Re: JS property 'strokeColor' not working

Post by Sasha - Tracker Dev Team »

Hello Martin,

You can try this code in the Acrobat - works the same as in the Editor. The thing is that the stroke color is a color of the annotation's border (that has a 0 width in this case).

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: JS property 'strokeColor' not working  SOLVED

Post by Sasha - Tracker Dev Team »

If you want to set the color of the text inside of the annotations, use something like this:

Code: Select all

var spans = new Array();
spans[0] = new Object();
spans[0].text = "sample text";
spans[0].fontFamily = ["Arial"];
spans[0].textColor = color.black;
spans[0].textSize = 7.09;
   
var annot = this.addAnnot({
type: "FreeText",
author: "John Doe",
width: 0,
page: 0,
strokeColor: ['RGB',0,0,0],
fillColor: color.transparent,
rect: [28.39,115.87,510.28,124.72],
rotate: 0,
richContents: spans,
alignment: 0,
readOnly: true});
Cheers,
Alex
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: JS property 'strokeColor' not working

Post by MartinCS »

Hi Alex,

I wasn't aware of the propety 'textColor'. It's working now!

Again thank you for help! It is most appreciated.

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

Re: JS property 'strokeColor' not working

Post by Tracker Supp-Stefan »

:D
Post Reply