Skip to main content
Participant
March 5, 2024
Question

Select/resize objects and frames in overset text

  • March 5, 2024
  • 2 replies
  • 399 views

Much of my InDesign work involves importing XML files to the Structure pane and dragging it into threaded text frames to create my layout. One problem with this is, images embedded in the XML end up being too big to fit the frame. My current fix involves pulling the overset text into a massive text box so I can select and resize the images, and then resize the object frames, then deleting the extra text box to snap everything back into the threaded layout, but since I'm working with translated documentation, you have to do this step 14 times for every single image, easily up to a couple hundred per document.

 

Again, the problem is that the images are hidden in overset text--I know a bunch of ways to make the process more efficient, but I still have to manually pull the images out of the overset text. Is it possible to select/resize objects (and their object frames) while they're hidden in overset text? At this point, I'm not picky on how--I'd be happy if I could select objects in the overset from the Links pane, or using a find/replace query, using an external script, directly from the document structure, by editing the dimensions or applying an object style or whatever.

This topic has been closed for replies.

2 replies

luis_mendes
Participating Frequently
May 8, 2024

I've found that the best solution is a multistep process.... that is to find the images (either via the XML structure or document links), then to scale (horizontally and vertically) the images (specifically) down to a small enough size to avoid oversetting text frames BY THEN modify the parent frame by fitting the text frame to content (at the much smaller size). The next step is to apply any resizing and/or object style options you desire. 

var myRoot = myDoc.xmlElements[0];
var imageElements = myRoot.evaluateXPathExpression (".//*[name()='Image']" );

if ( imageElements.length ) {
    for(var x = 0; x <=imageElements.length-1; x++){
        var imgBx = imageElements[x];
        app.select(imgBx);
        var myRectangle = imgBx.xmlContent.parent;
        myRectangle.allGraphics[0].horizontalScale = 10;
        myRectangle.allGraphics[0].verticalScale = 10;
        myRectangle.fit(FitOptions.FRAME_TO_CONTENT); 
        //var myCharacter = myRectangle.parent;
    }
}
Solution Architect, Creative Innovator
Robert at ID-Tasker
Legend
May 8, 2024

@luis_mendes

 

You can't select something that is the overset text.

 

This line is completely unnecessary:

 

 

app.select(imgBx);

 

 

And instead of double check - less and equal - and subtraction:

 

x <=imageElements.length-1

 

x < imageElements.length

 

luis_mendes
Participating Frequently
May 8, 2024

I had the Select in there to identify the element in the XML tree as I was debugging. It was correctly selecting the correct element through the loop, but unnecessary othewise. 
I have some old habits from teaching others about js zero indexing and sometimes use the length-1 to help reenforce the point, but agree X < is cleaner!

Thx for your input!

Solution Architect, Creative Innovator
Community Expert
March 10, 2024

I read this a few days ago and I tried to find a script to resize images that are anchored and then I tried to create a script that would resize anchored objects - nothing would work for me. 
I meant to come back to the thread. 

 

I did find things like this 
https://community.adobe.com/t5/indesign-discussions/script-to-adjust-the-size-of-a-graphic-on-xml-import-in-indesign/m-p/7503945

 

But I'm not sure exactly if that helps or not.

 

Is there anyway you can provide an example - or if it works or not?

Participant
March 18, 2024

I think I'm running into the same issue as the person in the linked post. I'll dig around and see if I can find the Laubender script they refer to (the link in their post doesn't work anymore), but essentially I'm trying to accomplish the same thing: resize the graphic and the graphic container on import, to avoid the need to manually pull huge objects out of overset text.

I'll report back if I figure it out!

Robert at ID-Tasker
Legend
March 18, 2024
quote

I think I'm running into the same issue as the person in the linked post. I'll dig around and see if I can find the Laubender script they refer to (the link in their post doesn't work anymore), but essentially I'm trying to accomplish the same thing: resize the graphic and the graphic container on import, to avoid the need to manually pull huge objects out of overset text.

I'll report back if I figure it out!


By @evan.thorne

 

Don't have XML to test - but what if you set FIT CONTENT TO FRAME for your graphic containers?

 

Otherwise - it's not possible to set GeometricBounds for items that are overset.