Skip to main content
Participant
June 12, 2024
Question

remove numbers from bookmarks

  • June 12, 2024
  • 2 replies
  • 318 views

HY.  I need a script for Adobe Acrobat Pro that removes only the numbers from the bookmark sublayers, keeping the other characters intact. Can anyone help? I asked ChatGPT, but his script partially works because in addition to the numbers it also removes the final part of the text. Any help? Thank you!!

This topic has been closed for replies.

2 replies

PDF Automation Station
Community Expert
Community Expert
June 12, 2024

What do you mean "sublayers"?  This will remove the numbers from all bookmarks:

 

function RenameBookmark(bkm, nLevel)
{
for (var i = 0; i < nLevel; i++)
{
bkm.name=bkm.name.replace(/[0-9]/g,"");
}
if (bkm.children != null)
for (var i = 0; i < bkm.children.length; i++)
RenameBookmark(bkm.children[i], nLevel + 1);

}
RenameBookmark(this.bookmarkRoot, 0)

try67
Community Expert
Community Expert
June 12, 2024

Do you have sub-bookmarks, too, or just the top-level ones?