3 Replies Latest reply on Apr 18, 2014 7:09 AM by BEGINNER_X

    text height to frame height


      Hi everyone,


      Im new to forum and scripting...


      I just want to get help from you for thebelow stuff.


      there is a single text frame which contains the text "Learn2Gro". and the point size is 5pt.


      I want to scale the text height to the height of the frame.


      i tried with transform options.  but it transforms to different sizes.....


      please see the attachment for further understanding....


      thanks for the help....


        • 1. Re: text height to frame height
          Chinnadk Level 4

          Hi mas,


          Try the below code.


          var doc = app.activeDocument;


          //First textframe of the first page.

          var textFrame = doc.pages.item(0).textFrames.item(0);


          while(textFrame.overflows == false)


              //Below line will increase the point size by 0.1 point until it reaches the height or width of the frame.

              textFrame.parentStory.pointSize =  textFrame.parentStory.pointSize + .1;


          textFrame.parentStory.pointSize =  textFrame.parentStory.pointSize - .1;




          • 2. Re: text height to frame height
            Learn2Gro Level 1

            thanks chinna,


            chin chinna. super & thanks very much.



            • 3. Re: text height to frame height
              BEGINNER_X Level 3

              Chinnadk: Thanks for giving the wonderful Script.


              Learn2Gro: May the below code also helpful, to fix the pointsize for the entire document.


              var myDoc = app.activeDocument;
              var myTextFrames = myDoc.textFrames.everyItem().getElements();
              for(i=myTextFrames.length-1; i>=0; i--)
                  while(myTextFrames[i].overflows == false)
                     myTextFrames[i].parentStory.pointSize += .1;
                      myTextFrames[i].parentStory.pointSize -= .1;




              1 person found this helpful