Annotations opaq% and text color not correct (via javascript creation)

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
jdknox
User
Posts: 17
Joined: Mon Aug 22, 2011 10:59 pm

Annotations opaq% and text color not correct (via javascript creation)

Post by jdknox »

We recently switched from the pdf viewer control to the pdf editor and discovered that the new viewer does not show correct opaqueness or color when creating an annotation dynamically via java script. The following javascript code creates an annotation but the viewer does not reflect the correct opaqueness or text color in the new tracker editor (works fine in the old tracker viewer though).

this.addAnnot({ author: "r102121",type: "FreeText",name: "c55f5b3c-2505-41a2-ae2205bfd648b179",page: 0,rect: [51.302703857421875,758.3575439453125,165.61856079101562,806.8701171875],contents: " This is a text anno that is suppose to be opaque with black text",creationDate: "Wed May 23 2018 14:40:27 GMT-0700 (Pacific Daylight Time)",style: "S",fillColor: ["RGB",0.5960000157356262,0.984000027179718,0.5960000157356262],strokeColor: ["RGB",0,0,0],borderEffectStyle: "S",ModDate: "Wed Maay 23 2018 14:40:48 GMT-0700 (Pacific Daylight Time)",subject: "Created On: 05/23/2018",width: 1,quads: [undefined],Opacity: "0.60" });

I've run this in the "FullDemo.exe" provided in the sdk with the same result. We use this dynamic creation of annotations for multiple business needs so please advise how I can fix or get a fix.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotations opaq% and text color not correct (via javascript creation)

Post by Sasha - Tracker Dev Team »

Hello jdknox,

This script works the same as it does in Adobe Acrobat - no Opacity there either.
You can add the annotation without using the javascript but by using the Operations:
https://sdkhelp.pdf-xchange.com/vi ... ots_addNew

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jdknox
User
Posts: 17
Joined: Mon Aug 22, 2011 10:59 pm

Re: Annotations opaq% and text color not correct (via javascript creation)

Post by jdknox »

Thanks Alex, your help is much appreciated as our annotation rendering feature (storage and re-rendering) is critical to our customer's biz need. Is your support team aware that the new tracker editor DOES NOT CORRECTLY RENDER the free text annotation (with regards to opaq and text color settings) using java script -AND- that the older tracker viewer DOES RENDER CORRECTLY with the same javascript?

If so...,is the problem documented anywhere? ...and are you saying the work around is to switch to the api technique you provided?

If not... have you been able to recreate this difference on your side with the javascript OR do you need any additional info (samples, video, etc) from us?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotations opaq% and text color not correct (via javascript creation)

Post by Sasha - Tracker Dev Team »

Hello jdknox,

There is no property "Opacity" but there is a property "opacity". Also, it does not take a string as an argument but it does take double value. All of that is due to specification:
https://www.adobe.com/content/dam/acom/ ... erence.pdf page 63.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jdknox
User
Posts: 17
Joined: Mon Aug 22, 2011 10:59 pm

Re: Annotations opaq% and text color not correct (via javascript creation)

Post by jdknox »

Thanks Alex, that worked nicely for the opacity! Do you have any ideas why the font for this annotation type begins as red? if you add the annotation below (using the fulldemo.exe in the sdk sample folder using the java script ui tab) you can now see the opacity works correctly. However, the font (strokeColor) still starts with red font. It's interesting in that if I resize the annotation the font then turns to the correct color (black in this example) as designated in the strokeColor attribute.

this.addAnnot({ author: "r102121",type: "FreeText",name: "c55f5b3c-2505-41a2-ae2205bfd648b179",page: 0,rect: [51.302703857421875,758.3575439453125,165.61856079101562,806.8701171875],contents: " This is a text anno that is suppose to be opaque with black text",creationDate: "Wed May 23 2018 14:40:27 GMT-0700 (Pacific Daylight Time)",style: "S",strokeColor: ["RGB",0,0,0],fillColor:["RGB",0.5960000157356262,0.984000027179718,0.5960000157356262],borderEffectStyle: "S",ModDate: "Wed Maay 23 2018 14:40:48 GMT-0700 (Pacific Daylight Time)",subject: "Created On: 05/23/2018",width: 1,quads: [undefined],opacity: .6 });


Thanks again for you help!
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotations opaq% and text color not correct (via javascript creation)

Post by Sasha - Tracker Dev Team »

Hello jdknox,

This behavior is indeed strange - a work item has been made to the appropriate developer and hopefully this will be fixed soon.
Meanwhile, you can use the operation that I've mentioned before for the correct usage of the SDK (not through the JS).

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jdknox
User
Posts: 17
Joined: Mon Aug 22, 2011 10:59 pm

Re: Annotations opaq% and text color not correct (via javascript creation)

Post by jdknox »

Thank you Alex!
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotations opaq% and text color not correct (via javascript creation)

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply