Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Delete Empty Comments with a Script

Community Beginner ,
Oct 08, 2021 Oct 08, 2021

Dear all, hope you are good and safe, 

could someone help me with the following?

after making a markup PDF with many comments, I want to run a script to search and delete just the empty comments (empty sticky notes, rectangles, circles). what I found until now is the following, but this removes everything.

 

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

 

 

TOPICS
JavaScript
519
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Oct 09, 2021 Oct 09, 2021

What do you mean by "empty", exactly? No attached comment text? If so, you can do it by changing this:

annots[i].destroy();

To this:

if (annots[i].contents=="") annots[i].destroy();

 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2021 Oct 09, 2021

What do you mean by "empty", exactly? No attached comment text? If so, you can do it by changing this:

annots[i].destroy();

To this:

if (annots[i].contents=="") annots[i].destroy();

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 10, 2021 Oct 10, 2021
LATEST

Amazing! thanks so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines