2 Replies Latest reply on Oct 25, 2011 3:45 AM by dilbertje

    Rotating pages in in Acrobat Reader using Javascript + AIR

    dilbertje Level 1

      Greetings,

       

      Currently we're building an application to view pdf files in an AIR application.

      We communicate with a javascript code, embedded in the PDF.

      Now, we want to rotate the pages of the document, but we cannot get this to work...

       

      Zoom, page up, page down, those work fine,

      but when we try to set the rotation for the pages, nothing happens.

       

      We also found rumours that rotating pages won't work in Acrobat Reader 9, but we need to be sure.

       

      all the help is appreciated!

       

      Regards,

       

      Mario

       

       

       

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

      //<Document-Level>
      //<ACRO_source>0000000000000000</ACRO_source>
      //<ACRO_script>
      /*********** belongs to: Document-Level:0000000000000000 ***********/

       

      function myOnMessage(aMessage)
      {
          if (aMessage.length==1)
          {
              app.alert(aMessage[0]);
              switch(aMessage[0])
              {
                  case "ZoomIn":
                      zoom *= 2;
                      break;
                  case "ZoomOut":
                      zoom /= 2;
                      break;
                  case "PageUp":
                      pageNum--;
                      break;
                  case "PageDn":
                      pageNum++;
                      break;
                  case "rotateClockWise":
                      app.alert("rotating, rotating, rotating...rawhiiddde!!");
                      this.setPageRotations(0,1,90);
                       app.alert("rotated?");
                      break;
                  case "pageFit":
                      zoomType = zoomtype.fitP;
                      break;
                  case "pageWidth":
                      zoomType = zoomtype.fitW;
                      break;
                  default:
                      app.alert("Unknown message: " + aMessage[0]);
              }
          }
          else
          {
              app.alert("Message from hostContainer: \n" + aMessage);
          }
      }

      function myOnDisclose(cURL,cDocumentURL)
      {
          return true;
      }

      function myOnError(error, aMessage)
      {
          app.alert(error);
      }

      var msgHandlerObject = new Object();
      msgHandlerObject.onMessage = myOnMessage;
      msgHandlerObject.onError = myOnError;
      msgHandlerObject.onDisclose = myOnDisclose; this.hostContainer.messageHandler = msgHandlerObject;

       

      //</ACRO_script>
      //</Document-Level>