Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

text height to frame height

Community Beginner ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

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....

textheight.png

thanks for the help....

mas....

TOPICS
Scripting

Views

619
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Apr 17, 2014 Apr 17, 2014

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;

Regards,

Chinna

Votes

Translate
Enthusiast ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

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;

Regards,

Chinna

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 18, 2014 Apr 18, 2014

Copy link to clipboard

Copied

thanks chinna,

chin chinna. super & thanks very much.

mas

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 18, 2014 Apr 18, 2014

Copy link to clipboard

Copied

LATEST

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();

alert(myTextFrames.length)

for(i=myTextFrames.length-1; i>=0; i--)

{

    while(myTextFrames.overflows == false)

    {

       myTextFrames.parentStory.pointSize += .1;

     }

        myTextFrames.parentStory.pointSize -= .1;

   }

Thanks

Siraj

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines