Copy link to clipboard
Copied
Hello,
I am looking to create bookmarks that are the same name as the page. I want to do this because I need to split the document up afterwords and want each file to have the same name as the page. All my pages are named correctly, I just need to create the bookmarks that have the same name as the page so when I spilit them they will have the same name as the page. I have 200+ pages per document so any automation would be helpful.
Thank you!
Copy link to clipboard
Copied
You can use this code to do it:
this.bookmarkRoot.remove();
for (var i=0; i<this.numPages; i++) {
this.bookmarkRoot.createChild({cName: this.getPageLabel(i), nIndex: i, cExpr: "this.pageNum = " + i});
}
Copy link to clipboard
Copied
When you say "page name", what do you mean, exactly?
Copy link to clipboard
Copied
Its the name that is the box left of the (1 of 100) and to the right of the the page up and down buttons. I need that name to be the name of the bookmark and ultimately the name of the document after I split it.
Copy link to clipboard
Copied
So you want to add a bookmark for each page in the file, pointing to that page and with the same name as the page?
The page's name is probably just "1", by the way, not "1 of 100".
Copy link to clipboard
Copied
You can use this code to do it:
this.bookmarkRoot.remove();
for (var i=0; i<this.numPages; i++) {
this.bookmarkRoot.createChild({cName: this.getPageLabel(i), nIndex: i, cExpr: "this.pageNum = " + i});
}
Copy link to clipboard
Copied
Thank you! The script comes back as undefined though. It does remove the bookmarks though. Just doesn't add them back.
Copy link to clipboard
Copied
You must select all of the code before running it. And "undefined" is not an error. Quite the opposite, actually. It means the script executed correctly, without errors and without returning any values.
Copy link to clipboard
Copied
Damn I am noob at this! Thank you so much! You just made my life so much easier.
Copy link to clipboard
Copied
Now the document is not splitting right. It not splitting at all ,it just recreating a new file with the name of the last bookmarked page. I really have no idea what is going on because everything should be high level.
Copy link to clipboard
Copied
That's probably happening because the bookmarks use a script to point to the pages, instead of a "Go to a page" action.
You can still split the file, using a script, like this (paid-for) one I've developed: Custom-made Adobe Scripts: Acrobat -- Extract Chapters by Bookmarks
Copy link to clipboard
Copied
Damn. Thank you still! I will try to figure it out on my own $40 is to much right now!
Copy link to clipboard
Copied
I was just using the 1 of 100 as reference to the box I was talking about. I am working on some drawings so the what I looking at is like C-1 (1 of 10) then C-2 (2-10). I just need the bookmark to be C-1,C-2 ect.
Copy link to clipboard
Copied
The important thing is to know that these page names are called "page labels". You can use the JavaScript method getPageLabel to get the page label string for any page. Then you can create bookmarks in the usual JavaScript way.
Copy link to clipboard
Copied
I am very new to scripts. So page labels, not page names got it! Do have a quick link to the JavaScript method by chance. If not I can look it up better because I know the right terminology! Thank you!
Copy link to clipboard
Copied
Hi Bobg
I understand your situation, as per your description above, you want to create bookmarks for the pages of your document.
- Are you trying to create the bookmarks with Adobe Acrobat DC?
- You can easily create bookmarks for your document with Adobe Acrobat DC, Please follow the help article in the link here - Page thumbnails and bookmarks in PDFs, Adobe Acrobat
I hope this will fix the issue for you, keep us posted with the result.
Regards,
Amal
Copy link to clipboard
Copied
Yes I am creating bookmarks the problem is that when I create the bookmark it says untitled. I was just wondering if there is a way to create a bookmark that is the same name as the page name instead of untitled. As of right now I am just going to the page creating the bookmark then renaming it. I just need a quicker way since I have 200+ page documents. At the end I just want to extract the documents as individuals with file name as the as the page name. Also I am using Adobe Acrobat Pro.
Copy link to clipboard
Copied
For any others that wish to accomplish this task: you can do it the manual way.
- Split the document on a page level.
- Download a bulk rename utility.
- Rename all of the files with the utility (usually a text file import with the current file name, this character (|), and the new name for every file. For example: 'Pages from Document Name (2)|Learning the Alphabet', 'Pages from Document Name (3)|The First Step', 'Pages from Document Name (3)|The Second Step'. This is easy using a copy file name utility and Excel's TEXTJOIN or CONCATENATE functions)
- Combine all of the files into one PDF with the 'Always add bookmarks to Adobe PDF' selected.
Doing it this way is hardly elegant, but it doesn't take too long, and it works.
Another way is to use a trial version of bookmark utility/add-on.

