Making comments read only

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

Post Reply
JarrahP
User
Posts: 8
Joined: Tue Feb 16, 2021 10:17 pm

Making comments read only

Post by JarrahP » Tue Feb 16, 2021 10:25 pm

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,

User avatar
TrackerSupp-Daniel
Site Admin
Posts: 4573
Joined: Wed Jan 03, 2018 6:52 pm

Re: Making comments read only

Post by TrackerSupp-Daniel » Tue Feb 16, 2021 10:52 pm

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,
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Support: <Support@tracker-software.com>
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

JarrahP
User
Posts: 8
Joined: Tue Feb 16, 2021 10:17 pm

Re: Making comments read only

Post by JarrahP » Thu Feb 18, 2021 2:11 am

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?

Willy Van Nuffel
User
Posts: 1659
Joined: Wed Jan 18, 2006 12:10 pm

Re: Making comments read only

Post by Willy Van Nuffel » Thu Feb 18, 2021 9:28 am

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.tracker-software.com/pdfxe9/layers-pane_ed.html

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

Re: Making comments read only

Post by Tracker Supp-Stefan » Thu Feb 18, 2021 11:36 am

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

JarrahP
User
Posts: 8
Joined: Tue Feb 16, 2021 10:17 pm

Re: Making comments read only

Post by JarrahP » Thu Feb 18, 2021 11:05 pm

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.

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

Re: Making comments read only

Post by Tracker Supp-Stefan » Fri Feb 19, 2021 10:49 am

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

JarrahP
User
Posts: 8
Joined: Tue Feb 16, 2021 10:17 pm

Re: Making comments read only

Post by JarrahP » Sun Feb 21, 2021 8:58 pm

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.

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

Re: Making comments read only

Post by Tracker Supp-Stefan » Mon Feb 22, 2021 1:13 pm

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

JarrahP
User
Posts: 8
Joined: Tue Feb 16, 2021 10:17 pm

Re: Making comments read only

Post by JarrahP » Thu Feb 25, 2021 9:31 pm

Thanks Stefan, I'm a total novice when it comes to scripts, could you provide a little more info or a tutorial? Thanks!

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

Re: Making comments read only

Post by Tracker Supp-Stefan » Fri Feb 26, 2021 12:00 pm

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

JarrahP
User
Posts: 8
Joined: Tue Feb 16, 2021 10:17 pm

Re: Making comments read only

Post by JarrahP » Sun Feb 28, 2021 10:31 pm

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.

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

Re: Making comments read only

Post by Tracker Supp-Stefan » Mon Mar 01, 2021 11:31 am

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

Post Reply