Skip to main content
Participating Frequently
August 13, 2015
Question

Script to adjust the size of a graphic on xml import in Indesign

  • August 13, 2015
  • 1 reply
  • 1351 views

I am looking for a way to resize incoming images from a xml export when it is imported it into Indesign.

Some images have for instance a width of 4500 mm on 72 dpi and comes into Indesign at an image size that exceeds the width of the text frame (never to be seen again... overset). We already have made a script that assigns each incoming graphic to a specific object style, based on a script of Laubender, but we are looking for a script that also resizes a graphic container on import.

Is this even possible? (resize/adjust the container size of an incoming graphic on xml import in Indesign, preferably to a size of for instance 160 mm width on import, WITH A SCRIPT)?

thanks

jeroen

This topic has been closed for replies.

1 reply

Legend
August 13, 2015

Hello,

Quick snippet ...

var doc = app.activeDocument;

var mRectangle = doc.xmlElements[0].xmlElements.itemByName("IMAGE").xmlContent.parent;

var mBounds = mRectangle.geometricBounds;

mRectangle.geometricBounds= [mBounds[0], mBounds[1], mBounds[2], mBounds[1]+160];

mRectangle.graphics[0].fit(FitOptions.proportionally);

mRectangle.graphics[0].fit(FitOptions.centerContent);

Regards

PelterAuthor
Participating Frequently
August 13, 2015

thank you for your quick answer. I will look into it.