Lock Comments

This Forum is for the use of End Users requiring help and assistance for Tracker Software's PDF-Tools.

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

Post Reply
dasy2k1
User
Posts: 65
Joined: Mon Feb 15, 2016 10:55 am
Location: Birmingham UK

Lock Comments

Post by dasy2k1 »

Is there a way to change the locked flag to yes on all comments using a PDF tools script?

as in Select all comments and lock them.

We have lots of documents that various comments get added to as they age (they are digitally signed before so the comments cant be flattened much as we wish this was possible (would be super good if you could have a signature that allowed all changes but flagged as Document has been changed since signing when this happened))

At the moment there is a real risk of important comments being accidentally moved or deleted when people are using the document on screen.

marking the comments as locked from the properties panel is what we are using at the moment to help prevent this problem but it would be much easier if there was a simple script i could get end users to run that simply locks all comments in a document in one hit
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Lock Comments

Post by TrackerSupp-Daniel »

Hi, dasy2k1

You should be able to lock comments in bulk by using JavaScript, which PDF-Tools does not yet support, but will be in a near future update. In the meantime, you can run it through the JS console in the PDF-Xchange Editor instead (Ctrl_J).

I am afraid that I do not have a sample of the JS code required to do this, but if you are familiar with JS, you could likely create it with some ease, and research in the Adobe JS API reference manual, here: https://www.adobe.com/content/dam/acom/ ... erence.pdf

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Lock Comments

Post by Vasyl-Tracker Dev Team »

There is a simple Java script you want:

Code: Select all

var pagesNum = this.numPages;
for (var i = 0; i < pagesNum; i++)
{
	var al = this.getAnnots(i);
	if (al != null)
	{
		var alen = al.length;	
		for (var j = 0; j < alen; j++)
		{
			var a = al[j];
			a.lock = true;
			a.readOnly = true;
		}
	}
}
Also in UI you may use the Comments pane: in the Menu/View/Panes/Comments click the Comments and Properties items to show the corresponding panes(Ctl+M and Ctl+`), then in Comments pane press the Ctrl+A to select all. Then in Properties pane switch the Locked to yes..
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
dasy2k1
User
Posts: 65
Joined: Mon Feb 15, 2016 10:55 am
Location: Birmingham UK

Re: Lock Comments

Post by dasy2k1 »

Thanks for the update,
Hopefully the PDF tools will have a Custom JS action soon. plenty of things i can think of that this would be super useful for.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Lock Comments

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
dasy2k1
User
Posts: 65
Joined: Mon Feb 15, 2016 10:55 am
Location: Birmingham UK

Re: Lock Comments

Post by dasy2k1 »

one more question, is there a flatten selected annotation JS

i have found flattenPages() which can accept a page number as the input to flatten all annotations on a selected page,

but is there one that will allow passing the annotation id as in your script above. something along the lines of flatten(a)

would certainly be useful but cant quite find it in the API
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Lock Comments

Post by TrackerSupp-Daniel »

Hi, dasy2k1

From what I can locate in the JS API manual, there does not appear to be a function to flatten a specific annot by ID, only the flattenpages function. If this is possible, I am afraid that I do not know how it would be done.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Peter2
User
Posts: 946
Joined: Mon Sep 13, 2010 10:09 am
Location: Switzerland

Re: Lock Comments

Post by Peter2 »

TrackerSupp-Daniel wrote: Wed Dec 16, 2020 9:50 pm ... in bulk by using JavaScript, which PDF-Tools does not yet support, but will be in a near future update. ...
Is it implemented in the current version? The search for "java" or "js" in the feature-description brings no results.
PDF-X-Change Pro German
User avatar
Dimitar - Tracker Supp
Site Admin
Posts: 1778
Joined: Mon Jan 15, 2018 9:01 am

Re: Lock Comments

Post by Dimitar - Tracker Supp »

Hello Peter2,

Unfortunately, it is still not implemented.

We will notify you when it is.

Regards.
Post Reply