These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Acrobat X: Exporting Bookmarks

juko8088
Registered: Apr 30 2011
Posts: 2
Answered

Hy everybody,
 
i need some help in Acrobat X and Scripting: I need to export the bookmarks of a .pdf-File which I made myself to Excel or .txt.
 
I found a script at www.evermap.com/javascript.asp as follows:
 
/* Create a bookmark report */
 
function PrintBookmark(Report, bm, nLevel)
{
 
// write a name of the bookmark
var inch = 72;
Report.writeText(bm.name);
 
// process children
if (bm.children != null)
{
Report.indent(inch/2);
for (var i = 0; i < bm.children.length; i++)
{
PrintBookmark(Report, bm.children[i], nLevel + 1);
}
Report.outdent(inch/2);
}
}
 
var root = this.bookmarkRoot;
var Report = new Report();
PrintBookmark(Report, root, 0);
 
// Change output path for the report
Report.save("/c/myreport.pdf");
  
If I copy this as "printbookmark.js" in the javascript-Folder and start the javascript-debugger in Acrobat, the following Error occurs:
 
bm is undefined
9:Folder-Level:App:PrintBookmark.js
TypeError: bm is undefined
9:Folder-Level:App:PrintBookmark.js
  
I think, i need to define "bm". But how can I do this?
 
Thanks for the replys in forward and sorry for my bad english,
 
Stefan

My Product Information:
Acrobat Pro 10.0.2, Windows
Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Accepted Answer
Hi,

you don't have to reinvent the wheel!
Try this first : http://acrobatusers.com/content/create-bookmark-report

;-)
juko8088
Registered: Apr 30 2011
Posts: 2
Thank you so much! It works!