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
Lock Comments
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
- TrackerSupp-Daniel
- Site Admin
- Posts: 8440
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Lock Comments
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,
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
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
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2352
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: Lock Comments
There is a simple Java script you want:
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..
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;
}
}
}
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.
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.
Re: Lock Comments
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.
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.
- TrackerSupp-Daniel
- Site Admin
- Posts: 8440
- Joined: Wed Jan 03, 2018 6:52 pm
Lock Comments
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
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
Re: Lock Comments
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
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
- TrackerSupp-Daniel
- Site Admin
- Posts: 8440
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Lock Comments
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,
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
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
Re: Lock Comments
Is it implemented in the current version? The search for "java" or "js" in the feature-description brings no results.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. ...
PDF-X-Change Pro German
- Dimitar - Tracker Supp
- Site Admin
- Posts: 1778
- Joined: Mon Jan 15, 2018 9:01 am
Re: Lock Comments
Hello Peter2,
Unfortunately, it is still not implemented.
We will notify you when it is.
Regards.
Unfortunately, it is still not implemented.
We will notify you when it is.
Regards.