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....
thanks for the help....
mas....
1 Correct answer
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
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
Copy link to clipboard
Copied
thanks chinna,
chin chinna. super & thanks very much.
mas
Copy link to clipboard
Copied
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

