7 Replies Latest reply on May 30, 2008 11:30 AM by (Rob_Whetzel)

    Javascript not Holding Page Magnification

      I am using a Javascript on a button that allows a popout menu to appear to the right with additional links. I have the PDF set to fit to page. When one of the rollout links are clicked, the page they go to open up to 148%. 148% is not fit page. Fit page is 82%.

      I think I need to add more code to the script so it holds the fit to page attribute throughout the document.

      If anyone knows of the script to do so, I would greatly appreciate it. Also, I do not have an option on the Javascript button to set the zoom level. My button is, onMouse Enter, Run Javascript.

      Thanks in advance.
        • 1. Re: Javascript not Holding Page Magnification
          Patrick Leckey Level 3
          Doc.zoomType = zoomtype.fitP

          Have you read the JS API Reference?
          • 2. Re: Javascript not Holding Page Magnification
            Level 1
            I just looked at the JS API Reference. I am not a code person so I did not understand all of it.

            Where would this Doc.zoomType=zoomtype.fitP be placed? Does it go on the button?
            • 3. Re: Javascript not Holding Page Magnification
              Patrick Leckey Level 3
              That depends entirely on your form and how you're processing the links.

              The "Doc" in "Doc.zoomType" just represents a generic Doc class object. You'll need to replace that with whatever variable name you are using to access the Doc class of the newly loaded view.
              • 4. Re: Javascript not Holding Page Magnification
                Level 1
                I am using the script on a Button. Are forms and buttons different?

                Also, "You'll need to replace that with whatever variable name you are using to access the Doc class of the newly loaded view." I have no idea what that means.

                Thanks for your patience.
                • 5. Re: Javascript not Holding Page Magnification
                  Patrick Leckey Level 3
                  Forms are collections of form objects. Buttons, lists, text, etc. all comprise portions of forms. I understand your script is only on the button, but you have not described the script or its function in the form workflow so there is very little I can say about where the place additional code with certainty. Like I said, it entirely depends on how you designed your form (and by that, I guess I should have said form workflow).

                  > Also, "You'll need to replace that with whatever variable name you are using to access the Doc class of the newly loaded view." I have no idea what that means.

                  In your code, I'm sure you use a method that begins with "this.". In that case, "this." is the container for the Doc class object for the currently open document. However, using "this." is tricky - it will always be the *currently active* document, regardless of what your script does. If the links you are processing in your fly-out menu open other documents, instead of simply moving to a different page in the same document, "this." will not work as a reference to the new document from inside the initiating document's button. You will need to acquire a reference to the newly opened documents Doc class object in order to perform any Doc class functions (as described in the JS API Reference) on that document.

                  I understand this may be confusing to you - but you do have to realize you are working with JavaScript. If you don't know JavaScript, it will be very hard for you to understand anything about it. Imagine going to Germany and meeting someone who only spoke German. Without learning the language, there is very little chance you'll be able to understand them. As with all developers that come on here looking for Acrobat JavaScript advice without knowing JavaScript, I strongly recommend you read some tutorials and examples on JavaScript before trying to develop with it. It will make life much easier.
                  • 6. Re: Javascript not Holding Page Magnification
                    Level 1
                    Here is the script im using:
                    var cDest =
                    app.popUpMenu ("A Message From NACCHO", "In Their Own Words");
                    this.gotoNamedDest (cDest);

                    I did not write my own script, I took it from another PDF that was made, then as I was double checking things, I noticed this issue.

                    I am looking for a quick fix if its possible.
                    • 7. Re: Javascript not Holding Page Magnification
                      Level 1
                      Is it possible for me to send to you the first page of this PDF to you so you can see what I have done?