1 Reply Latest reply on Aug 3, 2017 9:01 AM by T_Stevens

    Resize Anchored XML Text Frames

    T_Stevens Level 1

      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[i].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?