3 Replies Latest reply on Sep 5, 2016 1:55 AM by Test Screen Name

    Javascript to open multi-page doc to open to page two...?

    pdfUser1 Level 1

      I have a multi-page doc. Presently, whenever I open it, it opens to page one. What I'd like to do now is, after the first time I open the doc, have the doc open to page two instead of page one from then on. I use to have the code from the AcrobatUsers forum but cannot find it any longer, and I guess I didn't bookmark the page. So, can someone help me out by providing the necessary script? I'm not referring to the settings in the Properties/Initial View. Thanks guys.

        • 1. Re: Javascript to open multi-page doc to open to page two...?
          gkaiseril MVP & Adobe Community Professional

          You need to add a document level script to set the Acrobat JavaScript "pageNum" to the zero based value of "1".

           

          // open PDF on page ;

          this.pageNum = 1;

           

          If you were to place this code on the Page 1 "Page Open" action you would never be able to access page 1 unless you added code to only run this statement once.

          • 2. Re: Javascript to open multi-page doc to open to page two...?
            pdfUser1 Level 1

            Thanks for the input, but that's not what I was hoping to do. I use to have the script that would open to the first page then after that the document would open to page two (and continue to open to page two thereafter). That's what I was hoping to do. The script was provided on the AcrobatUser.com site by (I think) Dave Dagley. I've searched that site for that page but without any success, so I posted the question here. What I remember, it was an entirely different than  this.pageNum = 1;

             

            I do want the doc to open to the very first page, but only for the first time the user opens the doc. Then after that to open to page two of the doc. Can someone help me do this?

            • 3. Re: Javascript to open multi-page doc to open to page two...?
              Test Screen Name Most Valuable Participant

              We aim not to "provide" scripts, but more to help people learn how to make their own.

               

              Now, I think I understand what you want to do but there's a big problem with it. If you want something to happen the FIRST time it's opened and not after that, it means you have somehow to REMEMBER that you've done it.

               

              So... There are t places to remember, sorta. INSIDE the PDF and OUTSIDE the PDF. 

               

              inside, implies you change the PDF and then SAVE IT. Because if it isn't saved, it isn't changed. This can work, but it relies on the end user accepting saving it. If they quit without saving, next time will be first again. Also,will they be reopening a saved file? If it's on a web site or in an email they will be opening a new copy each time, for the first time.

               

              Outside seems attractive but Acrobat puts fearsome obstacles I the way of writing and reading files. There used to be global variables but I don't hear about them today, I think they were blocked.

               

              My my guess is that you can't do this except in very special cases such as when you personally administer all the target computers.