Copy link to clipboard
Copied
This is probably a really basic question, but how do I apply autonumbering to PDF bookmarks?
I've defined autonumbering for h1 and h2 in the layout.css of the PDF template, and would like to also display that numbering in the PDF bookmarks:
Thanks in advance.
Not the answer you want but in over twenty years of using RoboHelp I have not seen that question come up or any automated way of doing it.
________________________________________________________
My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.
Copy link to clipboard
Copied
Not the answer you want but in over twenty years of using RoboHelp I have not seen that question come up or any automated way of doing it.
________________________________________________________
My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.
Copy link to clipboard
Copied
Hi, You could post-process the PDF with an Acrobat JavaScript script that will add the numbers to the bookmarks. You would need Acrobat Pro to run the script. The feasibility would depend on the consistency of the pattern: if your level one bookmarks always get a consecutive number and the level two bookmarks always get the subnumbering. If there are exceptions, then it may not be worth it.
Copy link to clipboard
Copied
This script will prepend a single number to each bookmark like this:
but it could be modified to use the numbering style that you indicated. Here is the code. If you need help installing it or running it, please contact me offlist. rick at frameexpert dot com
if (app.viewerVersion >= 10) {
// Add a toolbutton for the command.
app.addToolButton({cName: "AddBookmarkNumberingCmd",
cTooltext: "Add Numbers to Bookmarks",
cExec: "addBookmarkNumbering ();",
cEnable: "event.rc = (event.target != null);",
nPos: -1 });
}
else { // 9 or below.
// Add the command to the Document menu.
app.addMenuItem({cName: "AddBookmarkNumberingCmd",
cUser:"Add Numbers to Bookmarks",
cParent: "Document",
cExec: "addBookmarkNumbering ();",
cEnable: "event.rc = (event.target != null);" });
}
function addBookmarkNumbering () {
numberBookmarks (this.bookmarkRoot);
}
function numberBookmarks (bkm) {
var regex, i, count, text;
regex = /^\d/; // Starts with a number.
if (bkm.children != null) {
// How many children of this bookmark, including the root?
count = bkm.children.length;
// Process all of the children bookmarks.
for (i = 0; i < count; i += 1) {
// Make sure the bookmark isn't already numbered.
if (regex.test (bkm.children[i].name) === false) {
// Prepend the number to the bookmark.
bkm.children[i].name = (i + 1) + ". " + bkm.children[i].name;
}
// Call this function recursively so all bookmarks are touched.
numberBookmarks (bkm.children[i]);
}
}
}
Copy link to clipboard
Copied
Thank you for taking the time to write out a script. I'll propose this solution as well to my team.
Copy link to clipboard
Copied
If you have budget for a finished script, please contact me offlist. rick at frameexpert dot com