Problem with fit image to frame

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().
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] ; ;

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


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

1 Like