I'm trying to write an ExtendScript script for InDesign to automatically generate a catalogue, which will be based on an inputted XML file.

As by now, I'm defining different page types for different types of product (e.g. a 5-column page for different components, a 8-column page for the product with multiple colour options, etc.), and I do so by first placing a text frame with an object style applied.

This object style has auto-sizing option active (in this way, shorter tables won't occupy an entire page, while frames with longer tables won't have overflow text).

For a specific page type, I need to:

  • read the geometricBounds of the textframe, to store its height in a variable;
  • unset the auto-sizing option (otherwise, any change in size won't be effective);
  • set a new, calculated, height, by changing the geometricBounds.

I'm having trouble with the second step, because I don't know which is the correct method/property/function to recall to change this setting.

3 Answers 3


I found a solution after a bit of working and searching.

The auto-sizing option I'm talking about is specific for text frames. It is that option that extends the text frame to fit its content, without overflows or excessive empty frame. It can be found in the Object > Text frame options menu, inside indesign, and it is described by the autoSizingType property of TextFramePreference.

What I needed to do was to add a textFramePreference:

myObj.textFramePreferences.autoSizingType = AutoSizingTypeEnum.OFF

being myObj the current pageItem object in the for loop that I'm trying to manipulate.


Here are other options for the AutoSizingTypeEnum

Let textFrame be the text frame on which you want to operate auto sizing.

textFrame.textFramePreferences.autoSizingType = AutoSizingTypeEnum.OFF;

Other options for the enum are in the image.


There are two things about it. You can override it for the page item or you can disable it in Object Style.

if you want to do it for the selected page item, (assuming only one item is selected):

app.selection[0].frameFittingOptions.autoFit = false; //or true to enable it.

If you want to disable it in the object style:

app.selection[0].appliedObjectStyle.frameFittingOptions.autoFit = false; //or true.

Changing the object style may impact other page items on which the style is applied.

  • Thank you for your reply, but maybe I wasn't that clear (I was 7 pm and I was tired after 9 h of coding). The auto-sizing (not auto fitting) property I'm talking about is a specific option for text frames. Secondly, I am passing the object (a pageItem) as a variable item in a for loop, because I need to place multiple items sequentially. Sep 8, 2018 at 6:23
  • 1
    Apologies. Please try the following: textFrame.textFramePreferences.autoSizingType = AutoSizingTypeEnum.OFF; Sep 8, 2018 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.