4 Replies Latest reply on Nov 18, 2013 10:26 AM by George_Johnson

    getting scroll position

    Bob.Mooney

      I can read and write the zoom level of a document (doc.zoom).  I can scroll to a specific point in the document (doc.scroll).  Bu I can't read the current scroll position.  Is there a way around this.

       

      The scenario:

           I have 24 pdf documents each with a single page containing a picture.

           Each picture was taken with a fixed camera - one picture for each hour of the day.  So the pictures are of the same thing - just separated taken at different times.

           On the 1:00 am picture I see something I want to examine more closely so I zoom and scroll to a particular portion of the picture.

           Now I want to see the same area on the 2:00 am picture.  I can read open the 2:00 am picture and zoom to the same zoom level (by reading the zoom property of the 1:00 am document).

           But how do I get the the 2:00 am document to scroll to the same position as the 1:00 am document if I can't read the scroll position of the 1:00 am document?

       

      My actual issue is more complex than this scenario but this illustrates the question.

        • 1. Re: getting scroll position
          try67 MVP & Adobe Community Professional

          There's a property of the document object called viewState which allows you to read and write that information, but it is very difficult to work with it, since it's an opaque object and doesn't allow direct access to its properties.

           

          Are you looking for something like syncronized scrolling of two documents?

          • 2. Re: getting scroll position
            Bob.Mooney Level 1

            In any case viewState only works with embedded PDF - which is not the scenario I have.

             

            In some respects I want something like synchronized scroll but I am dealing with multiple documents.  I open one document and zoom/pan to a particular spot.  Then I want to open another document with the same zoom and pan.  I will select the other document from a list which could have many dozens of documents.  It is impractical to open all the documents at the same time.

             

            One possibility I have not considered yet would be use Bookmarks.  Bookmarks store the zoom level but I don't know if they store the pan.

             

            What I want is something like the center point of the current view.  This value could be passed to doc.scroll.  Is there a parameter that gives the coordinates of the document view (not the screen coordinates - but the document coordinates?  I could calculate the point necessary for doc.scroll from thse coordinates.

            • 3. Re: getting scroll position
              try67 MVP & Adobe Community Professional

              viewState is not just for embedded PDF files, it is available in any open PDF document.

              And yes, bookmarks do maintain the exact zoom level and position when they're created.

              • 4. Re: getting scroll position
                George_Johnson MVP & Adobe Community Professional

                 

                In any case viewState only works with embedded PDF - which is not the scenario I have.

                 

                That's a documentation error.