Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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-im...
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?
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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;
}
}
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more