3 Replies Latest reply on Jun 27, 2014 7:57 AM by bernst@fastline.com

    Sort bookmarks alphabetically

    jay fresno Level 1

      I have several major bookmarks and quite a few subbookmarks below each of the major bookmarks, and the subbookmarks need to be alphabetical within their major bookmark category. I've not been able to find a feature in Acrobat Pro that will sort bookmarks. Does anyone on this forum know of such a feature or can point me to a script that will sort bookmarks?

        • 1. Re: Sort bookmarks alphabetically
          DimitriM Level 3

          Hi Jay,

           

          There is no feature built-in to Acrobat for doing this, but it can be accomplished with a script.  While I have not tried it myself, here is a link for a bookmark sorting script ( I think you would  have to pay a fee for it)-

          http://try67.blogspot.com/2010/08/acrobat-sort-bookmarks.html

           

          Hope this helps,

           

          Dimitri

          WindJack Solutions

          www.windjack.com

          www.pdfscripting.com

          • 2. Re: Sort bookmarks alphabetically
            Milo G Level 1

            I also need to do this.

             

            Here is a script to collect bookmarks into an array and then sort them alphabetically. The big part that is missing is how to then put them back in the document. Hopefully someone here can fill in this missing step.

             

            /* Gather Bookmarks into an Array */

            // Begin job setup

            if ( typeof global.bmArray == "undefined" ) {

            global.indexCnt = 0;

            global.bmFileCnt = 0;

            global.bmArray = new Array();

            }

            global.bmFileCnt++; // Count files

            // Get the path of the file Acrobat has taken from the selected folder

            var path2file = this.path;

            // Regular expression that acquires the base name of file

            var re = /.*\/|\.pdf$/ig;

            // filename is the base name of the file Acrobat is working on

            var filename = path2file.replace(re,"");

            // If the title is available, use it for a bookmark, else use filename

            if ((this.info.Title==null) || (this.info.Title.replace(/\s/g,"")==""))

            var bmToFile = filename;

            else

            var bmToFile = this.info.Title;

            global.bmArray[global.indexCnt] = [bmToFile,filename];

            global.indexCnt++;

             

            //Alphabetize bookmark list in array

            function compare (a,b) { // Define a compare function

            if (a[0] < b[0] ) return -1;

            if (a[0] > b[0] ) return 1;

            return 0;

            }

            global.bmArray.sort(compare);

            • 3. Re: Sort bookmarks alphabetically
              bernst@fastline.com Level 1

              Milo, did you ever find a solution?