1 Reply Latest reply on Jun 1, 2011 6:17 PM by milligramme

    Adjust textframe position

    xmlapi Level 1

      I got a textframe on page 1 that is properly aligned. All the other pages also have this textframe BUT at a diff position. Using a script, I want to align this textframe to the same geometric bounds as it is on page 1.


      How would I do this?

        • 1. Re: Adjust textframe position
          milligramme Level 3


          Did you set Ruler Origin to "PAGE_ORIGIN"? if not,

          at first you must set ViewPreferences.rulerOrigin.


          try this code.


          var doc = app.documents[0];

          var bk = doc.viewPreferences.rulerOrigin; //backup ruler origin

          doc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

          var pg = doc.pages;
          var properly_aligned = pg[0].textFrames[0].geometricBounds;
          for (var i=1, iL=pg.length; i < iL ; i++) {
              var tf = pg[i].textFrames[0];
              tf.geometricBounds = properly_aligned;
          doc.viewPreferences.rulerOrigin = bk; // revert setting


          thank you