Skip to main content
Participant
February 28, 2020
Answered

How to Delete all the comments from a PDF File

  • February 28, 2020
  • 3 replies
  • 13323 views
Can somebody help to know if there is a way to delete all the comments from a PDF in a single go?
 
I have some 1000+ PDFs, those have too many comments, i want to delete it in 1 go for each file.
 
May be i can try building a bot for that after then.
 
Please help
 
Thanks in advance
Correct answer try67

This code will remove all the comments from a file:

 

this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
	for (var i=annots.length-1; i>=0; i--) {
		annots[i].destroy();
	}
}

 

If you have Acrobat Pro you can use it in an Action and process multiple files in a single process.

 

3 replies

Participant
May 28, 2025

If you don't have Acrobat Pro, you can use a cheap 3rd party tool called BatchPurifier to remove comments from multiple PDF files in batch.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 28, 2020

This code will remove all the comments from a file:

 

this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
	for (var i=annots.length-1; i>=0; i--) {
		annots[i].destroy();
	}
}

 

If you have Acrobat Pro you can use it in an Action and process multiple files in a single process.

 

Participant
April 2, 2022

Where do I insert this code, I need direction on how and where to install this code, please

 

Inspiring
February 28, 2020

That's possible using JavaScript and can be automated with Acrobat. I know that code that does this has been posted in these and other forums, but post again if you can't find anything with a search.