3 Replies Latest reply: Oct 5, 2010 8:27 AM by stman RSS

    Delete Bookmark

    stman Community Member

      I have a PDF that is stitched together from three separate PDFs using the Combine > Merge Fines into a  Single PDF command. Basically, it's a book, with some "fluff" at the front and back (Part 1 = front; Part 2 = main; part 3 = back). When I generated the main PDF, I had bookmarks created, so that they look like a TOC.

       

      When I merge the three files together, a new top-level bookmark is created for each. It doesn't make sense to have bookmarks for the "fluff", so I just delete those corresponding to parts 1 and 3. However, I'm left with an orphaned bookmark for part 2, which expands to display the original sections like a TOC.

       

      I would like to delete this bookmark without deleting the subsections. Is this possible?

        • 1. Re: Delete Bookmark
          MichaelKazlow CommunityMVP

          Promote the bookmarks under the Part 2 bookmark. Then you can easily delete the Part 2 bookmark.

          • 2. Re: Delete Bookmark
            GKaiseril CommunityMVP

            You can drag an drop the bookmarks you want to keep and then delete the new higher level bookmarks ending in ".pdf".

             

            If you do this a lot, then you can use JavaScript for Removing filename bookmarks created by Acrobat by Sean Stewart. With this basic code you could create a function and add a menu item or toolbar button to run the code.

             

            function RemovePDFTypeFromBookmarks() {
            /*
            Author: Sean Stewart, ARTS PDF
            Date: 2 June 2004
            Description: When you merge documents using Acrobat's merge process
            it creates a high-level bookmark with the filename of the merged document and
            subordinates all bookmarks from the merged document below this.

            This script can be used to:
            1) moves all subordinated bookmarks up the bookmark tree; and
            2) delete the filename bookmark
            */

               // check for open document - gtk
               if(event.target == null) {
               app.alert('There is not open document to process', 1, 0);
               return; // exit further processing
               }

            var bm = this.bookmarkRoot;

            // Find the bookmarks which have .PDF and move all their children to the end
            // of the bookmark tree. Add each found bookmark to an array so that
            // it can be deleted at the conclusion of the process

            // Create an array to hold the bookmarks to delete @ a later stage


            if(this.bookmarkRoot.children != null) {

            try {
            var bmToDeleteArray = new Array();
            // console.show();
            // console.clear();
            // console.println("Removing bookmarks with string \".PDF\" in name");
            // Iterate through each bookmark
            var ibmLength = bm.children.length;
            for (var i = 0; i < ibmLength; i++)
            {
                // Check to see if this is a filename which
                // contains sub-ordinate bookmarks
                var bmToCheck = bm.children[i];
                // test as case insative
                if((bmToCheck.name.toLowerCase().indexOf(".pdf")!=-1) && (bmToCheck.children!=null))
                {
                    // console.println("found bookmark with children " + i);

                    // Move all children to the end of the root bookmark tree
                    // being sure to move the first item in each case
                    // note: this is because the queue is shrinking as
                    // we move each item

                    var ibmChildrenToMoveLength = bmToCheck.children.length;
                    for(var j=0; j<ibmChildrenToMoveLength; j++)
                    {
                       // console.println("moving bookmark " + j);

                       bm.insertChild(bmToCheck.children[0], bm.children.length);
                    }

                    // Add this to the array of bookmarks to be deleted later
                    bmToDeleteArray[bmToDeleteArray.length] = bmToCheck;
                }
            }


            // Iterate through the array of 'filename' bookmarks to delete
            // and delete them

            for (var i = 0; i < bmToDeleteArray.length; i++)
            {
            // Delete bookmark
               bmToDeleteArray[i].remove();
            }

            // Finally remove the array as a nicety
            delete bmToDeleteArray;
            // console.println(bmToDeleteArray.length + " booksmarks found and removed.");
            }
            catch (error) {
              app.alert("Error: " + error, 0, 3);
            }
            finally {
            // console.hide();
            } // end try
            } // end this.bookmarkRoot.children != null
            return;
            }

            // insert after the "Customize Tools" item on the Tools menu item (the default behavior)
            app.addMenuItem( { cName: "RemovePDFExt",
            cUser: "*Remove \".PDF\" from Bookmarks",
            cParent: "Tools",
            cExec: "RemovePDFTypeFromBookmarks()",
            cEnable: "event.rc = event.target != null",
            nPos: "Object Data"});

            • 3. Re: Delete Bookmark
              stman Community Member

              How do you promote bookmarks?