5 Replies Latest reply on Apr 23, 2016 12:28 PM by try67

    create bookmarks for front and back cover

    zimbop Level 1

      Go easy on me please I've been trying for two hours to do this simple thing! (At least, I presume it's simple).

       

      I'm trying to add bookmarks for the front and back cover of documents. The front cover will obviously be the first page (always!) but the back cover could be any page number, depending on the document. Funnily enough, I've done some work before for calculating the last page and that's not my problem.

       

      Anyway, from hackering around with stuff in the javascript reference, and some tutorial, I've so far got this:

       

      var myRoot = this.bookmarkRoot;

      myRoot.createChild({cName: "Front Cover", nIndex: 0});

      myRoot.createChild({cName: "Back Cover", nIndex: 99});

       

      So, this creates the two bookmarks where I need them, "Front Cover" at the start, and "Back Cover" at the end of the bookmarks already in the doc. Obviously this only works because the number of "already present" bookmarks will never exceed 99, but it seems to work ok!

       

      Anyway, my problem is that I can't for the life of me work out how to set the destination - I'm sorry I've reading the docs but as my experience is limited I'm finding it almost impenetrable. I'm thinking this should be simple because Front Cover should always point to page 0 (in a zero based index) and I'm not that bothered about "back cover" because I can reused the code for I've already got for working out the number of the last page. So if someone could help by telling me how to set "front cover" to land on the first page (page 0) when clicked - I can go to bed at a decent hour!!!