5 Replies Latest reply on Sep 27, 2016 12:02 AM by smithy70

    Resize overset text frame

    smithy70

      Hi,

       

      I am hoping someone can give me a solution as to why i get the following error using Indesign CC 2015

       

      JavaScript Error!

      Error Number : 1

      Error String: fit

      Engine:main

      Line: 10

      Source: lastFrame.fit(FitOptions.FRAME_TO_CONTENT);

       

      Using this code

       

      var doc = app.activeDocument;
      ResizeOverset();
      
      
      function ResizeOverset() { 
        var lastFrame,
        stories = doc.stories; 
        for (var j = stories.length - 1; j >= 0; j--) { 
        if (stories[j].overflows == true) { 
        lastFrame = stories[j].texts[0].parentTextFrames[stories[j].texts[0].parentTextFrames.length - 1]; 
        lastFrame.fit(FitOptions.FRAME_TO_CONTENT); 
        } 
        } 
      }
      

       

      Thanks