Problem with fit image to frame

Hi,
I place an png inside a rectangle. Now I need to fit the png to the rectangle but I don’t get it work with .fit().
rectImg.fit(FitOptions.CONTENT_TO_FRAME)
Have I a syntax mistake in it or must this written in a different way on UXP?

I had success with this code.

const { app, FitOptions } = require('indesign') ;
const rect = app.activeDocument.selection[0] ;
rect.fit(FitOptions.CONTENT_TO_FRAME) ;

Typical mistakes are that you did not import FitOptions. Does this apply to your case?

2 Likes

Hi,
super duper, yes the problem was not to import FitOptions.

1 Like