How to count my bookmarks in a doument?

The PDF-XChange Viewer for End Users
+++ FREE +++

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

mcounter008
User
Posts: 2
Joined: Wed Jun 26, 2013 4:01 am

How to count my bookmarks in a doument?

Post by mcounter008 »

I have numerous bookmarks in one documents.
How to count my bookmarks in a doument?
Thanks! :mrgreen:
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19919
Joined: Mon Jan 12, 2009 8:07 am

Re: How to count my bookmarks in a doument?

Post by Stefan - PDF-XChange »

Hello mcounter008,

You could use some JS code like the one below to read and "dump" the whole bookmark structure into a text format:

Code: Select all

function DumpBookmark(bkm, nLevel)
{
var s = "";
for (var i = 0; i < nLevel; i++) s += " ";
console.println(s + "+-" + bkm.name);
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);
To open the JS console in the Viewer/Editor use Ctrl-J

Regards,
Stefan
mcounter008
User
Posts: 2
Joined: Wed Jun 26, 2013 4:01 am

Re: How to count my bookmarks in a doument?

Post by mcounter008 »

Thank you for help. :D
User avatar
John - Tracker Supp
Site Admin
Posts: 5225
Joined: Tue Jun 29, 2004 10:34 am

Re: How to count my bookmarks in a doument?

Post by John - Tracker Supp »

;)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com