I’m converting from ExtendScript to UXP and this is giving me troubles
app.activeDocument.layoutWindows.item(0).zoom()
throws an error stating that Missing required parameter "given" for method 'zoom', and im trying to figure out how to properly apply the ZoomOptions. in ExtendScript i would say
app.activeDocument.layoutWindows.item(0).zoom(ZoomOptions.FIT_PAGE)
but that throws an error for ZoomOptions being undefined. If i place the number value stated in the docs like so it works, but thats not very readable for anyone else coming in
app.activeDocument.layoutWindows.item(0).zoom(2053534832)
so whats the new way to use ZoomOptions?
I think i figured it out, the ZoomOptions needs to be accessed from require("indesign"), took me a bit to piece that together.
const { app, ZoomOptions } = require("indesign")
Yeah, anything that is an enumeration has to be imported that way. I believe all the enumerations start with a capital letter.
I add the ones my project uses to the .js called by the manifest file using something like this:
var {
AnchorPoint,
AutoSizingTypeEnum,
BalanceLinesStyle,
BlendMode,
ColorModel,
ColorSpace,
ContentType,
ExportFormat,
FitOptions,
Justification,
LinkStatus,
LocationOptions,
LockStateValues,
MeasurementUnits,
PageNumberingOptions,
PNGExportRangeEnum,
PNGQualityEnum,
RulerOrigin,
SaveOptions,
ScriptLanguage,
StrokeAlignment,
TextFrameContents,
TextWrapModes,
UIColors,
UndoModes,
UserInteractionLevels,
VariableTypes,
} = require("indesign");