Fit frame to content?

Community Beginner ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

I can't find a way to set up the Fit frame to content as an Object Style Option. If that's not possible to accomplish, is there a way somehow to automate this function via script?

 

I have to place multiple images in my document, and I use Object Styles which resizes frame and image 

Size and Position Options → Size → Adjust Width Only

Frame Fitting Options → Fitting → Fit Content Proportionally

but that leaves the frame overset above and below the image so I need to click Fit frame to content every time.

TOPICS
Scripting

Views

88

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Apr 22, 2022 Apr 22, 2022
Hi @adamm.rs , you could script the application of the object style, followed by fit frame to content. So after you place, and while the placed object’s frame is still selected, run this (change "YourFitStyleName" to the name of your style). You can assign a key command to a script. var sn = "YourFitStyleName" var s=app.activeDocument.selection[0]; s.appliedObjectStyle = app.activeDocument.objectStyles.itemByName(sn) s.fit(FitOptions.FRAME_TO_CONTENT);

Likes

Translate

Translate
Adobe Community Professional ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

Hi @adamm.rs , you could script the application of the object style, followed by fit frame to content.

 

So after you place, and while the placed object’s frame is still selected, run this (change "YourFitStyleName" to the name of your style). You can assign a key command to a script.

 

 

 

var sn = "YourFitStyleName"
var s=app.activeDocument.selection[0];  
s.appliedObjectStyle = app.activeDocument.objectStyles.itemByName(sn)
s.fit(FitOptions.FRAME_TO_CONTENT);

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

LATEST

Hi Rob, 
awesome, this works! 🙂 Thank you very much!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines