• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to create numbered PDF bookmarks

Participant ,
Aug 02, 2023 Aug 02, 2023

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:

adobeRobohelpForum1.png

 

Thanks in advance.

TOPICS
New UI

Views

402

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 02, 2023 Aug 02, 2023

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.

 

Votes

Translate

Translate
Community Expert ,
Aug 02, 2023 Aug 02, 2023

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.

 

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 02, 2023 Aug 02, 2023

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2023 Aug 03, 2023

Copy link to clipboard

Copied

This script will prepend a single number to each bookmark like this:

 

image.png

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]);
		}
	}
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 04, 2023 Aug 04, 2023

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 04, 2023 Aug 04, 2023

Copy link to clipboard

Copied

LATEST

If you have budget for a finished script, please contact me offlist. rick at frameexpert dot com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp