JavaScript Code That Worked for Me

app.fs.isFullScreen = true; toggles application to fullscreen (when it wasn’t before).

this.pageNum += 1; (or this.pageNum++;) goes to next page (but it needs a page number to be set before, such as this.pageNum = 0;).1

app.setInterval works in an unclear way (at least, to me):2

  • This seems to me the standard way of setting an interval (at least, this is the way it works in ActionScript):

      this.pageNum = 0;
      app.setInterval("this.pageNum += 1;", 200);
    

    The interval seems to be forgotten after not so many loops. The number isn’t constant and it isn’t related to the time.

  • Adding a .count seems to solve the problem:

      this.pageNum = 0;
      function GoToNextPage() {
          this.pageNum += 1;
      }
      timeout = app.setInterval("GoToNextPage()", 10);
      timeout.count = 0
    

Code Not Useful for the Project

Booklet duplex printing may be achieved with:

var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.none;
pp.pageHandling = pp.constants.handling.booklet;
pp.booklet.duplexMode = pp.constants.bookletDuplexModes.BothSides;
this.print(pp);

Page scaling set to none and booklet printing don’t work simultaneously. This probably make sense, since the standard page should have page scaling disabled.3

Notes

  1. The same applies to this.pageNum -= 1; or this.pageNum--;

  2. This might be explained in the setInterval entry from the API reference

  3. The document itself should have the print scaling set to none. This would make the following code into the /Catalog dictionary:

    /ViewerPreferences <<
     /PrintScaling /None
    >>
    

    But the following code doesn’t work as expected. No booklet mode from JavaScript code.