Skip to main content
FarzanaA
Inspiring
June 25, 2026
Answered

Resizing Text frames on Master pages based on new margin settings

  • June 25, 2026
  • 1 reply
  • 12 views

Hello All,

I am developing a C++ plugin on InDesign Server 2026, where I need to resize the margins on the Master Pages. And based on new Inside / Outside margin values need to adjust the text frames (left and right ) on the master page. I tried adjusting through C++ functions like SetPathBoundingBox() / SetStrokeBoundingBox() /  Utils<Facade::IGeometryFacade>()->SetItemsBounds(). 

We noticed the text frame does not resize correctly. it leaves spaces either on Left or Right side.

I also tried calling java script to use the option AutoAdjustLayout which is on Margins dialog.

var mydoc = app.documents.item(0);
var myadjustprefs = mydoc.adjustLayoutPreferences;
myadjustprefs.enableAdjustLayout = true;

This does set the option as selected but does not reflect the text frames.

Has anyone tried this. Any advice or help would be really helpful.

Thanks & Regards

Farzana.

    Correct answer Eugene Tyson

    Hi Farzana,

    I would not rely on `adjustLayoutPreferences.enableAdjustLayout = true` by itself. That appears to set the document preference, but it does not necessarily execute the same layout adjustment operation that happens through the Margins and Columns dialog.

    For parent-page frames, I would handle this more explicitly read the page size, page side, and margin preferences, then calculate the intended geometric bounds for each parent text frame and set the frame bounds directly.

    For example, on a facing-pages document the left/right values need to be calculated from Inside/Outside, not from fixed Left/Right values:

    For a left-hand page:
    Inside = right side
    Outside = left side

    For a right-hand page:
    Inside = left side
    Outside = right side

    So the target bounds should be derived from the page’s actual side/spread position. Otherwise it is very easy to get the kind of gap you describe on either the left or right.

    I would also check whether you are setting geometric bounds versus stroke bounds. If the text frame has a stroke, inset spacing, text wrap, object style, or transform applied, using stroke/path bounds can give a result that looks slightly offset. For text frames I would generally calculate and set the geometric bounds explicitly, then separately deal with inset spacing if needed.

    I would treat Adjust Layout as unreliable for this server-side automation case and resize the parent text frames manually from the margin values.
     

    1 reply

    Eugene TysonCommunity ExpertCorrect answer
    Community Expert
    June 25, 2026

    Hi Farzana,

    I would not rely on `adjustLayoutPreferences.enableAdjustLayout = true` by itself. That appears to set the document preference, but it does not necessarily execute the same layout adjustment operation that happens through the Margins and Columns dialog.

    For parent-page frames, I would handle this more explicitly read the page size, page side, and margin preferences, then calculate the intended geometric bounds for each parent text frame and set the frame bounds directly.

    For example, on a facing-pages document the left/right values need to be calculated from Inside/Outside, not from fixed Left/Right values:

    For a left-hand page:
    Inside = right side
    Outside = left side

    For a right-hand page:
    Inside = left side
    Outside = right side

    So the target bounds should be derived from the page’s actual side/spread position. Otherwise it is very easy to get the kind of gap you describe on either the left or right.

    I would also check whether you are setting geometric bounds versus stroke bounds. If the text frame has a stroke, inset spacing, text wrap, object style, or transform applied, using stroke/path bounds can give a result that looks slightly offset. For text frames I would generally calculate and set the geometric bounds explicitly, then separately deal with inset spacing if needed.

    I would treat Adjust Layout as unreliable for this server-side automation case and resize the parent text frames manually from the margin values.
     

    FarzanaA
    FarzanaAAuthor
    Inspiring
    June 25, 2026

    Hi Eugene,

    Thank you so much for the reply. I just thought on Desktop application AdjustLayout would work thus was trying that option. But as you mentioned Will try to calculate spread, Margin , page to derive the text frame coordinates.

    Thank you once again.

    Farzana.