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

JS property 'strokeColor' not working

Post by MartinCS » Fri Jan 12, 2018 3:00 pm

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

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

Re: JS property 'strokeColor' not working

Post by Sasha - Tracker Dev Team » Mon Jan 15, 2018 9:29 am

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

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

Re: JS property 'strokeColor' not working  SOLVED

Post by Sasha - Tracker Dev Team » Mon Jan 15, 2018 9:47 am

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

Post by MartinCS » Mon Jan 15, 2018 10:02 am

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: 13560
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: JS property 'strokeColor' not working

Post by Tracker Supp-Stefan » Mon Jan 15, 2018 10:08 am

:D

Post Reply