4 Replies Latest reply on May 23, 2011 1:50 PM by maxwyss

    Doc.scroll() issues

    maxwyss Level 4

      I don't know whether it is a bug or a feature, but it looks as if there is a discrepancy between the Acrobat JavaScript documentation and the reality in Acrobat 9 and 10:


      According to the documentation, Doc.scroll() should put the coordinates specified in the middle of the window. That would mean that if you zoom in sufficiently, and specify the coordinates of the center of a field, that field should be fully visible, and centered.


      In my tests, however, the center of the field got moved to the upper left corner of the screen.


      If it is a platform dependency, it would be on Mac, and Acrobat 9 and 10; a quick check in Acrobat 7 showed the same behavior.


      Now, the question is, if it is a feature, what would be the best strategy to achieve correct display, meaning that the field would appear in the middle (more or less) of the screen.


      Any comment is highly appreciated.


      Max Wyss.

        • 1. Re: Doc.scroll() issues
          George_Johnson MVP & Adobe Community Professional

          It's been a while since I've scrolled. Can you use a named destinations instead?

          • 2. Re: Doc.scroll() issues
            maxwyss Level 4

            Thanks for the advice, George.


            The problem is that the elements which should be the center for the scroll are annotations, created using JavaScript.


            I would love to work with Named Destinations, but I may be too dumb to find a way to create them using JavaScript. And manual creation is out of the question, because the project will have to deal with thousands of such places, and there is not enoug time to create those Named Destinations.


            I would see a way to somehow sneak them in using FDF, as I can create the FDF from the document, but I have not yet followed up on this path (and I don't think that I can use FDF to inject the information for named destinations). And for the development of a plug-in, the budget is too restricted…


            Max Wyss.

            • 3. Re: Doc.scroll() issues
              George_Johnson MVP & Adobe Community Professional

              I figured it was something like that, and I don't know of a way to automate the process of adding named destinations, so that won't work. I'll let you know if I think of anything.

              1 person found this helpful
              • 4. Re: Doc.scroll() issues
                maxwyss Level 4

                Thanks, George; well, I am kind of predictable…


                The current workaround is a bit crude, but does work. I am simply adding an offset which pushes the visible window up a little bit. The advantage is that in "normal" view, the concerned area is always at the same distance from the top of the screen, making the work more efficient.


                But that does not really resolve upcoming issues, where a named destination would really be helpful. Ah well… I know that I sometimes kick the system to the limits…