Skip to main content
Andreas Jansson
Inspiring
December 16, 2016
Answered

How is APPLY_FRAME_FITTING_OPTIONS supposed to work?

  • December 16, 2016
  • 1 reply
  • 2638 views

I don't understand how the FitOption called Apply_Frame_Fitting_Options is supposed to work. According to documentation it applies the current frame fitting options to the frame and content, but as I see it (using scripting) it doesn't.

Is there anyone out there, who can explain?

You can follow my tests below, step-by-step:

1. Add a graphic frame to an empty document

2. Right click the frame. In the pop-up menu select Fitting / Frame Fitting Options. In the dialogue box select "Fit content Proportionally" for the frame.

3. Adjust the paths in the code below to two test images of your choice, with different proportions and sizes.

app.activeDocument.pages[0].rectangles[0].place(File('/C//temp//test.jpg'));

app.activeDocument.pages[0].rectangles[0].place(File('/C//temp//test2.jpg'));

app.activeDocument.pages[0].rectangles[0].fit(FitOptions.APPLY_FRAME_FITTING_OPTIONS);

The first image (test.jpg) will come out right, adapting its size proportionally within the frame.

Calling the fit method with APPLY_FRAME_FITTING_OPTIONS (line 3) will however not change the fitting, and neither will changing the fitting manually from the Frame Fitting Options dialogue, unless you right click and select "Fitting / Clear Frame Fitting Options".

Calling the fit method with a frameFittingOption explicitly set to PROPORTIONALLY or even read out from the frame (from the property called fittingOnEmptyFrame), works the way I would have expected from APPLY_FRAME_FITTING_OPTIONS.

app.activeDocument.pages[0].rectangles[0].place(File('/C//temp//test.jpg'));

app.activeDocument.pages[0].rectangles[0].place(File('/C//temp//test2.jpg'));

app.activeDocument.pages[0].rectangles[0].fit(app.activeDocument.pages[0].rectangles[0].frameFittingOptions.fittingOnEmptyFrame);

The documentation says:

FitOptions.APPLY_FRAME_FITTING_OPTIONS

Applies the current frame fitting options to the frame and content.

So why didn't ...

app.activeDocument.pages[0].rectangles[0].fit(FitOptions.APPLY_FRAME_FITTING_OPTIONS);

... re-apply the selected fittingOption?

I hope there is someone who can explain what I'm doing wrong when applying APPLY_FRAME_FITTING_OPTIONS, and how it is meant to work.

Best regards,

Andreas Jansson

The message was edited by: Andreas Jansson

This topic has been closed for replies.
Correct answer Andreas Jansson

Andreas Jansson wrote:


But I still wonder how APPLY_FRAME_FITTING_OPTIONS is supposed to work.

Me too, Andreas.

Maybe it is working in special circumstances?!
Or is APPLY_FRAME_FITTING_OPTIONS a remnant from the older days where it worked with maybe CS3 or CS4?


The DOM documentation is always sparse on comments and often misses examples.
A quick search on the web is revealing nothing but the DOM or API documentation cited.

Regards,
Uwe


APPLY_FRAME_FITTING_OPTIONS is redundant, according to Adobe. I got this answer from Adobe:

The APPLY_FRAME_FITTING_OPTIONS setting is working as expected. Although, it would be justified to say that this setting is redundant and hence not relevant.

When you place the second image, it positions the image according to the crop settings of the first image and the crop values for the frame are updated.

So, when Fitting option is applied, it just re-applies the same setting.

1 reply

Community Expert
December 20, 2016

Hi Andreas,

what is the version of InDesign you are using?

I cannot tell about the "why is this not working with FitOptions.APPLY_FRAME_FITTING_OPTIONS", but I see the same behavior with InDesign CS6 v8.1.0 on Mac OSX 10.6.8.

One workaround would be to remove the first image before placing the second one so that the fittingOnEmptyFrame preferences of the rectangle can kick in.

var fileToPlace1 = File('/C//temp//test.jpg');

var fileToPlace2 = File('/C//temp//test2.jpg');

var rect = app.activeDocument.pages[0].rectangles[0];

rect.frameFittingOptions.fittingOnEmptyFrame = FitOptions.FILL_PROPORTIONALLY;

rect.place(fileToPlace1);

// Remove all stuff from rectangle before placing a second time:

if(rect.pageItems.length>0)rect.pageItems.everyItem().remove();

rect.place(fileToPlace2);

Regards,
Uwe

Andreas Jansson
Inspiring
December 21, 2016

I've tested this in InDesign CC 2017 (ver. 12.0.0.81) on Windows, and I get the same behaviour in CS6 for Windows.

With your approach we've now got two work-arounds : )

Either explicitly applying the "fittingOnEmptyFrame" setting, or emptying the frame before placing the new image.

But I still wonder how APPLY_FRAME_FITTING_OPTIONS is supposed to work.

Thanks,

Andreas

Community Expert
December 21, 2016

Andreas Jansson wrote:


But I still wonder how APPLY_FRAME_FITTING_OPTIONS is supposed to work.

Me too, Andreas.

Maybe it is working in special circumstances?!
Or is APPLY_FRAME_FITTING_OPTIONS a remnant from the older days where it worked with maybe CS3 or CS4?


The DOM documentation is always sparse on comments and often misses examples.
A quick search on the web is revealing nothing but the DOM or API documentation cited.

Regards,
Uwe