- the optional content group (layer) that an annotation is assigned to; and
- the blend mode assigned to the annotation
[javascript FR] annotation get/set of OCG (Layer) and Blend Mode SOLVED
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange, Tracker - Clarion Support, John - Tracker Supp, Support Staff, moderators
-
Mathew
- User
- Posts: 764
- Joined: Thu Jun 19, 2014 7:30 pm
[javascript FR] annotation get/set of OCG (Layer) and Blend Mode
A couple of annotation properties that are conspicuously absent in the javascript API are:
-
Daniel - PDF-XChange
- Site Admin
- Posts: 12518
- Joined: Wed Jan 03, 2018 6:52 pm
Re: [javascript FR] annotation get/set of OCG (Layer) and Blend Mode
Hello, Mathew
Thank you for the suggestions.
I could be wrong, but I vaguely recall hearing that OCG's are not able to be handled by JS due to some unique bits of their use/implementation, but perhaps I misremembered or it has changed.
Blend mode on the other hand I cannot say I have ever heard anything against.
I have forwarded both requests to the Dev team to see what comes of them.
Kind regards,
Thank you for the suggestions.
I could be wrong, but I vaguely recall hearing that OCG's are not able to be handled by JS due to some unique bits of their use/implementation, but perhaps I misremembered or it has changed.
Blend mode on the other hand I cannot say I have ever heard anything against.
I have forwarded both requests to the Dev team to see what comes of them.
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
-
Mathew
- User
- Posts: 764
- Joined: Thu Jun 19, 2014 7:30 pm
Re: [javascript FR] annotation get/set of OCG (Layer) and Blend Mode
Thanks Daniel. Looks like both are part of the annotation dictionary as of ISO 32000-2: Blend Mode is much more recent though.Daniel - PDF-XChange wrote: ↑Thu Sep 11, 2025 9:31 pm I could be wrong, but I vaguely recall hearing that OCG's are not able to be handled by JS due to some unique bits of their use/implementation, but perhaps I misremembered or it has changed.
You do not have the required permissions to view the files attached to this post.
-
Daniel - PDF-XChange
- Site Admin
- Posts: 12518
- Joined: Wed Jan 03, 2018 6:52 pm
Re: [javascript FR] annotation get/set of OCG (Layer) and Blend Mode
Hello, Mathew
That is good to hear, hopefully it translates to good news from the Dev team!
RT#7633: JS-FR: Annot OCG and Blend mode access
Kind regards,
That is good to hear, hopefully it translates to good news from the Dev team!
RT#7633: JS-FR: Annot OCG and Blend mode access
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
-
Ivan - Tracker Software
- Site Admin
- Posts: 3602
- Joined: Thu Jul 08, 2004 10:36 pm
Re: [javascript FR] annotation get/set of OCG (Layer) and Blend Mode SOLVED
In version 10.7.3, a property blendMode has been added for the annot object.
It is a read/write property.
Example of setting Multiply blend mode for all annots on the first page:
or the same, but in a "modern way":
Global object blendModes contains constants for all possible blend modes. To get the list, just run
HTH
It is a read/write property.
Example of setting Multiply blend mode for all annots on the first page:
Code: Select all
var annots = getAnnots(0);
for (var i = 0; i < annots.length; ++i)
annots[i].blendMode = blendModes.multiply;
Code: Select all
getAnnots(0).forEach((a) => a.blendMode = blendModes.multiply);
Code: Select all
blendModes.toSource();
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
Ivan - Tracker Software
- Site Admin
- Posts: 3602
- Joined: Thu Jul 08, 2004 10:36 pm
Re: [javascript FR] annotation get/set of OCG (Layer) and Blend Mode
Also, added read/write property OC (optional content).
It allows assigning an OCG (layer) to the annotation, or getting the assigned OCG.
If the annotation has no OCG, this property will have a value null.
To set a value to this property, a null or OCG object should be used.
Unfortunately, due to the limitations of the JS model, if an annotation object has an associated OCMD, this property will have the value null as the OCMD is not presented in the JS model.
It allows assigning an OCG (layer) to the annotation, or getting the assigned OCG.
If the annotation has no OCG, this property will have a value null.
To set a value to this property, a null or OCG object should be used.
Unfortunately, due to the limitations of the JS model, if an annotation object has an associated OCMD, this property will have the value null as the OCMD is not presented in the JS model.
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.