Skip to main content
Participant
Feb 28, 2020 5:56 AM UTC
Answered

How to Delete all the comments from a PDF File

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
try67
try67Correct answer
Community Expert
Feb 28, 2020 8:38 AM UTC

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.

 

8 replies

Participant
May 28, 2025 5:57 PM UTC

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.

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Feb 28, 2020 8:38 AM UTC

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.

 

Translate
Participant
Apr 2, 2022 4:08 PM UTC

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

 

Translate
Inspiring
Feb 28, 2020 7:33 AM UTC

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.

Translate