Page 1 of 1

Making comments read only

Posted: Tue Feb 16, 2021 10:25 pm
by JarrahP
Hi There,

I'm trying to figure out if I can change the read only property of a comment, I'm working with a document and I want to blank out some existing areas semi-permanatley and work with the document as though the content isn't there, but still have them there if i need them in the future.
image.png
What i really need is to be able to "flatten" and "unflatten" comments, or something similar.

Cheers,

Re: Making comments read only

Posted: Tue Feb 16, 2021 10:52 pm
by TrackerSupp-Daniel
Hi, JarrahP

The Read-only property can only be modified via the use of JavaScript. In order to disable it, you will need to understand JS and make use of the JS API reference Manual: https://www.adobe.com/content/dam/acom/ ... erence.pdf

Otherwise, the property you are looking for is the "Locked" property. This will have essentially the same effect, but can be modified through the GUI after being applied.

There is no way to "unflatten" as flattening converts and in most situations, removes much of the information that makes a comment a comment. This simply becomes base content, and there is no way to "detect" that is was previously anything else or reverse the process.

Kind regards,

Re: Making comments read only

Posted: Thu Feb 18, 2021 2:11 am
by JarrahP
Neat, thanks for that! The "locked" property almost does what I want it to do, but the "select comments" tool still selects locked comments which is a bit annoying. Ideally they'd be unselectable by anything other than a dedicated process if that makes sense. Is that possible?

Re: Making comments read only

Posted: Thu Feb 18, 2021 9:28 am
by Willy Van Nuffel
What about working with layers ?

Comments can be put on one or more specific layers. Each layer can be made visible or not.

https://help.pdf-xchange.com/pdfxe9/layers-pane_ed.html

Re: Making comments read only

Posted: Thu Feb 18, 2021 11:36 am
by Tracker Supp-Stefan
Hello Willy Van Nuffel,

I think JarrahP wants his comments to be visible but not really selectable.
So switched off layers might not be what he want but definitely has it's uses!

The way to make the comments visible but not selectable is to make them read only - via JS. That way those objects will still remain annotations, and can be read as such by the other process that JarrahP refers to.

Kind regards,
Stefan

Re: Making comments read only

Posted: Thu Feb 18, 2021 11:05 pm
by JarrahP
Thanks for the suggestion willy, yeah Stefan is right layers don't do what I want unfortunately.

Might have to look in to the forbidden magix that is JS.

Re: Making comments read only

Posted: Fri Feb 19, 2021 10:49 am
by Tracker Supp-Stefan
Hello JarrahP,

Do you want to make ALL comments on all pages read only or only the comments of e.g. a specific author?

Kind regards,
Stefan

Re: Making comments read only

Posted: Sun Feb 21, 2021 8:58 pm
by JarrahP
Only specific comments.

I guess ideally I'd be able to have a layer I could move comments to that made them read only while on that layer or something. I'd be the author of the comments I'd want to make read only, so being able to make all comments by an author read only would not be super useful, though I guess i could change the author or something.

Re: Making comments read only

Posted: Mon Feb 22, 2021 1:13 pm
by Tracker Supp-Stefan
Hello JarrahP,

Just checked - and it is possible that you indeed create a layer, and then place all of your comments on that layer, and you can then run a simple script to lock the layer (in whichever state it was - visible or invisible), and only someone with a similar script can unlock that layer, while others will not be able to change it's visibility through the UI.

However the individual comments will not be themselves locked and can still be selected and e.g. deleted through the comments pane.

I could not find a way to get a JS that will e.g. recognize which layer given comments are on - so that I can lock only those comments directly.

Kind regards,
Stefan

Re: Making comments read only

Posted: Thu Feb 25, 2021 9:31 pm
by JarrahP
Thanks Stefan, I'm a total novice when it comes to scripts, could you provide a little more info or a tutorial? Thanks!

Re: Making comments read only

Posted: Fri Feb 26, 2021 12:00 pm
by Tracker Supp-Stefan
Hello JarrahP,

Create the layer, and add your comments to that layer through the normal UI commands.

Then open the JS console (Ctrl + J), and in there copy and paste the following (making sure to update the name value from 'Test' to the actual name of your layer):

Code: Select all

var ocgArray = this.getOCGs();
for (var i=0; i < ocgArray.length; i++) {
  if (ocgArray[i].name == "Test") {
    ocgArray[i].state = !ocgArray[i].state;
  }
}
Then his the green triangle to execute the above script - and it will toggle the visibility of your layer.

Kind regards,
Stefan

Re: Making comments read only

Posted: Sun Feb 28, 2021 10:31 pm
by JarrahP
If I'm right all that script does is toggle the visibility of the layer? What I'm after here is to make comments visible, but not selectable with the select comments tool, on the main content window.

Re: Making comments read only

Posted: Mon Mar 01, 2021 11:31 am
by Tracker Supp-Stefan
Hello JarrahP,

Apologies - should be careful what I am copy-pasting! :)

Code: Select all

var ocgArray = this.getOCGs();
for (var i=0; i < ocgArray.length; i++) {
  if (ocgArray[i].name == "Test") {
    ocgArray[i].locked = !ocgArray[i].locked;
  }
}
But then again - as mentioned earlier - this will lock the layer itself, but the comments can still be selected in the comments pane.

Kind regards,
Stefan