I occasionally need to create an index from the bookmarks of a PDF. Here are the steps I took.
First I used bates stamping to give my original document page numbers. I use PDF-Xchange Editor (paid) which includes bates stamping. There are other alternatives to create the page numbering.
Download jpdbookmarks and extract the whole folder (there is no need to install). I just put my extracted folder on the desktop
http://skylineservers.dl.sourceforge.net/project/jpdfbookmarks/JPdfBookmarks-2.5.2/jpdfbookmarks-2.5.2.zip
For MS Windows, run jpdfbookmarks.exe — for Linux or other see documentation in the folder
Within jpdbookmarks, open the document that has the bookmarks you want to convert to an index.
On the menu bar select <Tools/Dump> which will dump the bookmarks into a text file. Once that is done you can close jpdbookmarks.
Open the resulting text file (I named mine index.txt) in Scite (or some other text program that allows regex search and replace).
This is an example of one line from the text file:
Nonprofit Board Governance/1,Black,notBold,notItalic,open,TopLeftZoom,87,91,0.0
The number just after the forward slash is the page number the bookmark would go to. The other information to the right of that is irrelevant for my index.
Within Scite I use the find and replace tool with regular expressions.
First I replace the forward slash with a tab.
Pay attention to the checked boxes as well as the Find What and Replace with. Click on Replace All.
Next I want to get rid of the extraneous information — from the comma after the page number to the end of the line.
Now I have a nice text file with the bookmark name and the relevant page number.
I copied the text from Scite, then I went into Libre Writer, pasted, and used a tab stop that included dots (actually, I used the special character elipsis because it has a little more spacing than the default dot). Finished formatting in Writer and then saved as a pdf, inserted that pdf into my original pdf to have an index page.
-end-