Copy link to clipboard
Copied
I have a lot of jobs where I need to have the specific size image at the top of an A4 page with 3mm bleed.
Just wondering if it's possible to have a script that i can execute with an image selected on the page and it sizes it to 216mm width, 116.522mm height, and set the Y coordinate to 55.261mm. Also if it could centre the image horizontally to the page that would be great also (don't think this can be done with the x coordinate because it might change depending if its a pages vs spreads layout?).
Any help with this would be greatly appreciated, thanks!
Example:
You can set the size and position in the object styles.
Just apply the object style to the image you want.
Window>Styles>Object Styles
And scroll down the menu on the left
Select the image frame:
var y = 55.261; var h = 116.522; var w = 216;
app.scriptPreferences.measurementUnit = MeasurementUnits.MILLIMETERS;
var pw = app.documents.item(0).documentPreferences.pageWidth;
app.documents.item(0).selection[0].geometricBounds = [y, pw-w, y + h, w];
app.documents.item(0).selection[0].fit(FitOptions.PROPORTIONALLY);
Copy link to clipboard
Copied
Sorry forgot to mention, if it could fill frame proportionally after the resize that would be great too.
Copy link to clipboard
Copied
You can set the size and position in the object styles.
Just apply the object style to the image you want.
Window>Styles>Object Styles
And scroll down the menu on the left
Copy link to clipboard
Copied
Select the image frame:
var y = 55.261; var h = 116.522; var w = 216;
app.scriptPreferences.measurementUnit = MeasurementUnits.MILLIMETERS;
var pw = app.documents.item(0).documentPreferences.pageWidth;
app.documents.item(0).selection[0].geometricBounds = [y, pw-w, y + h, w];
app.documents.item(0).selection[0].fit(FitOptions.PROPORTIONALLY);
Copy link to clipboard
Copied
That's fantastic.
Just wondering if the style route is better as you could tweak the position and all would update.
Does the script do that?
Copy link to clipboard
Copied
I don’t think you can set a specific x or y position with a style unless the image is anchored in a text flow?
Copy link to clipboard
Copied
I think it does work. I will have to try tomorrow
Copy link to clipboard
Copied
Yes, you’re right. I forget about the size and position option, which got added a few versions back, and which I obviously never use.
Copy link to clipboard
Copied
Thanks Rob. Although it does size and fit the frame correctly, it doesn't move it to the top of the page for me. Did you test it and it worked for you? I'm on CC 2019 so not sure if that's a factor for it not working.
Copy link to clipboard
Copied
Nevermind, figure out i had to set Y to -3. Then it puts it in the right spot. Thanks Rob!!!