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

Resize Anchored XML Text Frames

Community Beginner ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

I've been banging my head against a wall about this for a while and I just can't figure it out.

I have imported an XML file that includes quote tags.

Screen Shot 2017-08-03 at 9.07.22 AM.png

The quotes are anchored to the body of the text and I have an object style applied that stylizes the frame. The image is a headshot of the person who said the quote and they're all a standard size (about 60 points tall).

The problem I'm having is that sometimes the quotes are smaller than the headshot. When that happen, the image extends past the text frame.

Screen Shot 2017-08-03 at 9.11.36 AM.png

I'm trying to write a script that will get the height of the text frame and if it's less than 82 points, increase it to 82 points.

What I have so far is:

var myRoot = myDoc.xmlElements.item(0);

var bqs = myRoot.evaluateXPathExpression("//blockQuote");

for (var i = 0; i < bqs.length; i++) {

        t = bqs.xmlContent;

        try {

            s = t.textContainers[0];

        }

        catch (e) {

            break;

        }

        b = s.geometricBounds;

        //adjust the bounds to be the right size

}

When I try to run this, it errors when I try and get the geometric bounds. Somehow, this line gives me "Invalid object for this request".

Any ideas on how I can get this to work?

TOPICS
Scripting

Views

278

Translate

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 ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

LATEST

So a co-worker pointed out that I could just set a minimum size in the auto-fit text frame option in the object style. That works for the particular job I'm working on now, but I'm still confused on why I couldn't get the geometric bounds.

Votes

Translate

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