11 Replies Latest reply: Dec 31, 2010 12:30 PM by FrancisFukuyama RSS

    How to make bookmarks programmatically ?

    FrancisFukuyama Community Member

      How to make bookmarks programmatically ?

      This question has never be adequately answered as I searched these forums.

       

      I have examined bookmark properties and they are atleast of three implementation styles.

       

      1. The one made on UI have no javascript and no named destination.

       

      2. The one made using this script are

      this.bookmarkRoot.createChild("chapter 1: Making a Javascript Bookmark", "this.pageNum=15");

       

      3. There are also some which have no javascript but use a named destination.

       

       

      I want to make the style 1 programmatically as the style 2 require javascript turned ON, which is a security risk as its now common info that there are hackers who know how to exploit and are unfortunately smarter than adobe's security brains, certainly smarter than simpletons and newbies like us.

       

      I can right click on a type 2 and reset its destination and it becomes type 1.

       

      How to make type 1 bookmark programmatically ... a very reasonable question ? And if you know this, perhaps shed light on how to make type 3 also.

       

      Thanks,

      Francis Fukuyama

        • 1. Re: How to make bookmarks programmatically ?
          lrosenth Adobe Employee

          A bookmark (Outline) in PDF can have one of two things associated with it - an Action or a Destination.  There are about a dozen pre-defined Actions (JavaScript, Launch, URI, etc.) and two types of Destinations (Named and explicit). 

           

          Depending on which set of APIs for Acrobat you are working with, will determine which of these you have access to.

           

          JavaScript can only do assign a JavaScript action (#2 below).

          IAC/COM can assign an explicit destination (page #) and a JavaScript (IIRC).

          Plugins have FULL RANGE of capabilities

           

          That help?!?

          • 2. Re: How to make bookmarks programmatically ?
            FrancisFukuyama Community Member

            where do I find those dozen pre defined actions and dodge any javascript so that I can make a bookmark operational.

             

            Someone posted this link where there was this question raised or similar type of action i want

             

            http://forums.adobe.com/message/2595278#2595278

             

            which is what i get with the UI when I do CTRL-B in a pdf file.

             

            hope i can get a snippet code that can actually help me as searching thru manuals did not give any solution other than what involves javascript.

             

             

            GO TO A PAGE IN THIS DOCUMENT  <-------- this is what i want

            • 3. Re: How to make bookmarks programmatically ?
              lrosenth Adobe Employee

              You still haven't told us which of the APIs you are working with?  If you are writing a plugin (or using the Adobe PDFLibrary) then look at the PDBookmark and PDAction objects.

              • 4. Re: How to make bookmarks programmatically ?
                FrancisFukuyama Community Member

                > You still haven't told us which of the APIs you are working with?  If  you are writing a plugin (or using the Adobe PDFLibrary) then look at  the PDBookmark and PDAction objects.

                 

                I did not know that there are more than one APIs available.

                 

                Can you name some of the API's that are available ?

                 

                I have looked at the plugin guide and read some on how to make a callback and so on and understand that there are many plugins which make their methods available and various layers AS AV PD COS.

                 

                I also have some idea how the java based eye text can do some things .. and done a few.

                 

                If you consider the UI as an API, then I really prefer to make from the javascript console, bookmarks which dont need javascript for their OPERATION.

                 

                Hitherto, the only bookmarks I know how to make from js console need a js code fragment and are not to my requirements.

                 

                To this newbie, if you list the options available, the API's out there and what they provide, it would help making the decision.

                 

                I am seeing the mechanics of the process in one example that has AVPageViewToViewDest ( )

                 

                Francis

                • 5. Re: How to make bookmarks programmatically ?
                  lrosenth Adobe Employee

                  If you are using the UI, then you can assign ANY action or destination to the bookmark.  After you create it, just right-click, choose Properties and make whatever changes you want.

                   

                  From JavaScript, you can only assign other JavaScript.

                   

                  Plugins are written in C/C++, and there are many samples.

                  • 6. Re: How to make bookmarks programmatically ?
                    dying veteran Community Member

                    I told you in the other forum that its not possible to do your number one even though consultant Gilad Rozeboom aka try67 who sells plugins on his site, said it can.

                     

                    Hello, irosenth, does it stand for Iriving Rosenthal ?

                    • 7. Re: How to make bookmarks programmatically ?
                      FrancisFukuyama Community Member

                      Hi Irosenth, whats IAC/COM? inter application communication ?

                       

                      can you give me some code which I can quickly run and I dont know VB or activeX at all.

                       

                      so if you give anything from then it should be more complete.

                       

                      thanks

                      • 8. Re: How to make bookmarks programmatically ?
                        lrosenth Adobe Employee

                        So what are you programming in then?   Code is in the SDK...

                        • 9. Re: How to make bookmarks programmatically ?
                          FrancisFukuyama Community Member

                          Irosenth chimed > So what are you programming in then?   Code is in the SDK...

                           

                          I always try to answer your questions but you dont give me much perspective which can be a little educational and what I consider might be helpful.

                           

                          I am programming in the language that was invented by kernighan and ritchie and is the successor to B which is the successor to PL-1.

                           

                          Consider the fact that acrobat has been out for probably more than 3,650 days now and there is not a single open source nicely commented code for plugin to make bookmarks ?

                           

                          I am trying to use student version of VS2003/2005 or some free compiler of C. Do you have any fruitful suggestions ?

                           

                          Francis Fukuyama.

                          • 10. Re: How to make bookmarks programmatically ?
                            lrosenth Adobe Employee

                            I don't know where you've looked in the SDK, but there is a perfectly named sample in the SDK -

                            \Acrobat 9 SDK\Version 1\PluginSupport\Samples\SnippetRunner\Sources\snippets\Shared\MakeBookmarkSnip.cpp

                            • 11. Re: How to make bookmarks programmatically ?
                              FrancisFukuyama Community Member

                              lrosenth wrote:
                              I don't know where you've looked in the SDK, but there is a perfectly
                              named sample in the SDK - \Acrobat 9 SDK\Version
                              1\PluginSupport\Samples\SnippetRunner\Sources\snippets\Shared\MakeBoo
                              kmarkSnip.cpp

                               


                              Does that perfect example of yours compile with djgpp ? Is it possible
                              to test and see if it complies with gnu c++ compiler by the free
                              software foundation ? I understand that your company compiles acrobat
                              for linux using this or another compiler ... so gnu on windows is not that bad data for you to have and generate. Once you test, you would be
                              helping many others ... for the company that feeds and clothes its employees.