2 Replies Latest reply on Oct 1, 2014 4:23 AM by virender_CTS

    how to fit "frame to content" for a selected textframe by user?



      i am creating a script in which a textframe is selected and several operations are performed but on a line i got stuck since morning.

      var sourceDoc = app.activeDocument;

      var myFrame = sourceDoc.selection;

      myFrame.fit(FitOptions.FRAME_TO_CONTENTS); // error here myFrame.fit is not a function


      I tried with

      app.activeDocument.selection.fit(FitOptions.FRAME_TO_CONTENTS); // error again


      then i copied that textframe to new document and tried.

      app.activeDocument.pageItems[0].fit(FitOptions.FRAME_TO_CONTENTS); /// it works fine


      Please help.