8 Replies Latest reply on Jun 30, 2011 8:13 AM by George_Johnson

    Page sizes change when activating script

    djdgoode

      Hi

       

      I have a PDF document with navigation and a javascript index page button. The document is set to be in full screen and when you navigate using the next and back it keeps the page at fill screen setting. When you move to a page via the scripted index button it goes to the correct page but then the page size changes to a different smaller size. Is there anyway I can add in to the script an instruction that the page must always be Fill Screen so that it doesn't change size when using the index navigate button.

       

      Script 1

       

      //-------------------------------------------------------------

      //-----------------Do not edit the XML tags--------------------

      //-------------------------------------------------------------

       

      //<Document-Level>

      //<ACRO_source>NavigateMenu</ACRO_source>

      //<ACRO_script>

      /*********** belongs to: Document-Level:NavigateMenu ***********/

      function NavigateMenu()

      {

      var cDest = app.popUpMenu("Intro","-", "Pharma","-","Surgical","-",  "VisionCare","-", "VisionsMagazine","-","ResponseForm");

       

      this.gotoNamedDest(cDest)

      }

      //</ACRO_script>

      //</Document-Level>

       

      //<AcroForm>

      //<ACRO_source>Index:Annot1:MouseEnter:Action1</ACRO_source>

      //<ACRO_script>

      /*********** belongs to: AcroForm:Index:Annot1:MouseEnter:Action1 ***********/

      NavigateMenu()

      //</ACRO_script>

      //</AcroForm>

       

      //<AcroForm>

      //<ACRO_source>Index:Annot2:MouseEnter:Action1</ACRO_source>

      //<ACRO_script>

      /*********** belongs to: AcroForm:Index:Annot2:MouseEnter:Action1 ***********/

      NavigateMenu()

      //</ACRO_script>

      //</AcroForm>

       

      //<AcroForm>

      //<ACRO_source>Index:Annot3:MouseEnter:Action1</ACRO_source>

      //<ACRO_script>

      /*********** belongs to: AcroForm:Index:Annot3:MouseEnter:Action1 ***********/

      NavigateMenu()

      //</ACRO_script>

      //</AcroForm>

       

      //<AcroForm>

      //<ACRO_source>Index:Annot4:MouseEnter:Action1</ACRO_source>

      //<ACRO_script>

      /*********** belongs to: AcroForm:Index:Annot4:MouseEnter:Action1 ***********/

      NavigateMenu()

      //</ACRO_script>

      //</AcroForm>

       

      //<AcroForm>

      //<ACRO_source>Index:Annot5:MouseEnter:Action1</ACRO_source>

      //<ACRO_script>

      /*********** belongs to: AcroForm:Index:Annot5:MouseEnter:Action1 ***********/

      NavigateMenu()

      //</ACRO_script>

      //</AcroForm>

       

      //<AcroForm>

      //<ACRO_source>Index:Annot6:MouseEnter:Action1</ACRO_source>

      //<ACRO_script>

      /*********** belongs to: AcroForm:Index:Annot6:MouseEnter:Action1 ***********/

      NavigateMenu()

      //</ACRO_script>

      //</AcroForm>

       

       

      Javascript Functions

      function NavigateMenu()

      {

      var cDest = app.popUpMenu("Intro","-", "Pharma","-","Surgical","-",  "VisionCare","-", "VisionsMagazine","-","ResponseForm");

       

      this.gotoNamedDest(cDest)

      }

       

      I hope that someone can help as the job is meant to be with the client now!!!!

       

      Many thanks

      David

       

       

        • 1. Re: Page sizes change when activating script
          George_Johnson MVP & Adobe Community Professional

          Are you saying that you want the document to always be displayed in full screen mode (Ctrl+L), or that the zoom is always "Fit Page" (Ctrl+0)?

          • 2. Re: Page sizes change when activating script
            djdgoode Level 1

            Hi

             

            The project is set to open in Full Screen and works fine when using the next and back button but if you jump to a page using the index button, using the code as shown, then the page is a smaller size in the middle of the window. If you then use the next and back buttons it keeps to the new size.

             

            What I need is for the size of the page to remain consistant however you move between the pages.

             

            No additional scripting has been set to change the view or size.

             

            Thank you

            • 3. Re: Page sizes change when activating script
              BarlaeDC Level 4

              Hi,

               

              If I remember correctly destinations remember the zoom factor at the time of creation.

               

              if this is the case then I am not sure what would be the best solution as I don't think you can create named destinations with zoom set to full screen.

               

              You could maybe work out some call using the zoomtype property and have multiple destinations that go to the same location with different zooms?

               

              hope this helps

               

              Malcolm

              • 4. Re: Page sizes change when activating script
                try67 MVP & Adobe Community Professional

                It's probably caused because you're using named destinations. You can try to

                manually set the zoom level back to Fit Page after going to the named dest.

                • 5. Re: Page sizes change when activating script
                  George_Johnson MVP & Adobe Community Professional

                  Since you want to remain in full screen mode, set up your code so that you go to the page number you want, as opposed to a named destination. Going to a named destination will take the user out of full screen mode. To change to a particular page number, set the pageNum property. The first page is page 0, the second is page 1, etc.

                   

                  // Go to the sixth page
                  this.pageNum = 5;
                  
                  1 person found this helpful
                  • 6. Re: Page sizes change when activating script
                    djdgoode Level 1

                    Sorry I am trying to learn Javascripting and so I understand what this is doing but not where to put it!

                    Where do I need to add this script, in the Edit all script section which has the large section of scripting or the Document Javascript?

                     

                    Again the purpose of the pages being named is that every page is related to a topic and so the names assist people to go directly to that subject.

                    Does this change mean that the index list that pops up will now show page numbers and not subject titles?

                     

                    Is there a better way to have a pop up menu that gives a quick access to any page with the page title?

                     

                    Many thanks

                    • 7. Re: Page sizes change when activating script
                      BarlaeDC Level 4

                      Hi,

                       

                      you could change your function to be something like

                       

                      function NavigateMenu()

                      {

                      var cDest = app.popUpMenu("Intro","-", "Pharma","-","Surgical","-",  "VisionCare","-", "VisionsMagazine","-","ResponseForm");

                       

                      switch ( cDest)

                      {

                           case "Intro":

                                this.pageNum = 1;

                                break;

                           case  "Pharma":

                                this.pageNum = 3;

                                break;

                           case "Surgical";

                                this.pageNum = 6;

                                break;

                           case  "Surgical":

                                this.pageNum = 3;

                                break;

                           case  "VisionCare":

                                this.pageNum = 3;

                                break;

                           case  "VisionsMagazine":

                                this.pageNum = 3;

                                break;

                             case  "ResponseForm":

                                this.pageNum = 3;

                                break;

                           default:

                                this.pageNum = 1; // in case something goes wrong.

                                break

                      }

                      }

                       

                       

                       

                      Hope this helps

                       

                      Malcolm

                      • 8. Re: Page sizes change when activating script
                        George_Johnson MVP & Adobe Community Professional

                        To make the code easier to maintain, it could be simplified to the following:

                         

                        function NavigateMenu() {
                        
                            // Create an object to associate an item with a page number
                            var oDest = {
                                "Intro" : 1,
                                "Pharma" : 2,
                                "Surgical" : 3,
                                "VisionCare" : 4,
                                "VisionsMagazine" : 5,
                                "ResponseForm" : 6 
                                };
                        
                            var cDest = app.popUpMenu("Intro","-", "Pharma", "-","Surgical", "-",  "VisionCare", "-", "VisionsMagazine", "-", "ResponseForm");
                        
                            // Go to the page number associated with the item
                            if (cDest) {
                                pageNum = oDest[cDest];
                            }
                        
                        }
                        

                         

                        If you use app.popUpMenuEx, you could build the pop up menu based on the object oDest, instead of hardcoding it, which would make it even more maintainable. See the documentation for more information.

                         

                        Edit: corrected typo