Copy link to clipboard
Copied
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
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hm…
Digged out an old thread at www.hilfdirselbst.ch from 2011 where I gave some advice. 😉
The OP, Jürgen, replied in the last post of this thread with a code snippet where APPLY_FRAME_FITTING_OPTIONS is used. Don't know, if I tested this snippet back then:
Regards,
Uwe
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi Andreas,
do you know when this option became redundant?
Or was it already redundant since its introduction?
Regards,
Uwe
Copy link to clipboard
Copied
Adobe support looked into their source code to look for an explanation why nothing happened when using the fitting option in question (they could repeat the same behaviour), and I got the answer above.
So I'm sorry, I don't know whether it has ever been a relevant option to use. But at least I got it confirmed that it's nothing that one should use today.