1 Reply Latest reply on Jan 5, 2009 6:56 AM by (Robert_Tkaczyk)

    [JS CS3] Page side when adding pages

    frameexpert Level 4
      Hello all,

      I am using a script to remove oversets by adding pages with linked text frames to the end of the document. When I am done removing the oversets, I check to make sure the document ends on a left page; if not, I am using the code below to add an extra page. However, the page ends up as a second right hand page right next to the previous one. How do I ensure that the page I add is a left-hand page. Thanks in advance.

      Rick Quatro
      rick at frameexpert dot com
      585-659-8267

      // Set a variable for the active document.
      var oDoc = app.activeDocument;

      // Call a function to remove the oversets
      //...

      // Make sure the document ends on a left page.
      if (oDoc.pages[-1].side == PageSideOptions.RIGHT_HAND)
      {
      AddPageAndLinkedTextFrame(oDoc);
      }

      function AddPageAndLinkedTextFrame(oDoc)
      {
      var oPage = oDoc.pages.add(LocationOptions.AFTER,oDoc.pages[-1]);
      var oTextFrame = oPage.textFrames.add();
      oTextFrame.geometricBounds = GetPageMarginBounds(oDoc,oPage);
      oTextFrame.previousTextFrame = oDoc.pages[-2].textFrames[0];
      }