I have recently been combining multiple PDF documents and had to create a table of contents in MS Word with the title of each document and its corresonding page number. Since I did not want to have to wade through all of the bookmarks manually, I modified one of the example Javascript examples from Adobe to generate a list of every bookmark in the PDF and show its page number. This script works by executing the bookmark action and then returning the currently displayed page number, so if your document other types of bookmarks it will probably return an error. However, if you are simply combining multiple PDFs the auto-generated bookmarks should work just fine.
Simply add the following javascript to your document (there is probably a better way to do this, but this works for my purposes for now):
-
Select Advanced>Document Processing>Document Javascripts...
-
Create a new Javascript and name it
-
Paste the following code in the Editor
function DumpBookmark(bkm, nLevel)
{
var s = "";
for (var i = 0; i < nLevel; i++)
s += " ";
bkm.execute();
console.println(s + "" + bkm.name + "\t" + (this.pageNum + 1));
if (bkm.children != null)
for (var i = 0; i < bkm.children.length; i++)
DumpBookmark(bkm.children[i], nLevel + 1);
}
console.clear();
console.show();
console.println("Dumping all bookmarks in the document.");
DumpBookmark(this.bookmarkRoot, 0);
When you close this window the script should automatically run and output the following text, which you can then paste into Word and build your manual table of contents. Remember, this javascript is now embedded with the document and will now run every time you open it! Make sure to delete the script from the Document Javascripts dialogue box and resave the document, or simply do not save the document when prompted after you have added and run the Javascript.
You can find more information about using Javascript with Adobe Acrobat 8 on Adobe's website.