Viewport & Zoom

Generated reference for the iPrintessApi methods tagged #ai-api:viewport-zoom in printess-editor.d.ts. Custom types referenced below (parameter and return shapes) are documented on the Types reference.

allowZoomOptions

allowZoomOptions(): boolean

return if zoom options should be displayed

Returns: boolean

autoScaleDetails

autoScaleDetails(): { enabled: boolean, width: number, height: number }

Retrieves information if the auto-scale option was enabled on attachPrintess() Also returns the calculated pixel-dimension of printess container on desktop

Returns: { enabled: boolean, width: number, height: number }

autoScaleEnabled

This method is deprecated.

autoScaleEnabled(): boolean

Returns true if autoScale was set in attachPrintess call

Returns: boolean

centerSelection

centerSelection(focusFormFieldId?: string, forceZoom?: "spread" | "frame"): Promise<number>

Auto Zooms to current selection or spread

Parameter Type Description
focusFormFieldId? string FF id to zoom to
forceZoom? “spread” | “frame” overwrites natural behaviour

Returns: Promise<number>

centerSpreadInView

centerSpreadInView(part?: "entire" | "left-page" | "right-page"): void

Centers the current spread in the printess view container

Parameter Type Description
part? “entire” | “left-page” | “right-page”

Returns: void

forceZoomToSinglePageOnMobile

forceZoomToSinglePageOnMobile(): boolean

Ignore entire page click, and always zoom to single page

Returns: boolean

getZoomMode

getZoomMode(): "spread" | "frame"

Retrieves the current zoomMode (see setZoomMode())

Returns: “spread” | “frame”

globalScaleFactor

globalScaleFactor(): number

Returns current global scale factor, should be !== 1 only on iOS devices to avoid safari-crashes

Returns: number

hasAnimation

hasAnimation(): boolean

Tells if current template has an animation-timeline

Returns: boolean

hasZoomToSelectionButton

hasZoomToSelectionButton(focusFormFieldId?: string): boolean

Tells if ui should display a zoom-to-selection button Only returns true if a significant zoom would happen

Parameter Type Description
focusFormFieldId? string FF id to zoom to

Returns: boolean

isAnimationPlaying

isAnimationPlaying(): boolean

Tells if animation-timeline is playing

Returns: boolean

isIPhone

isIPhone(): boolean

Tells if the current device is an iPhone or iPod.

Returns: boolean

isMobile

isMobile(): boolean

Tells if printess detects the current device as a mobile device.

Returns: boolean

isSoftwareKeyBoardExpanded

isSoftwareKeyBoardExpanded(): boolean

On IOS returns if iphone has its keyboard expanded. This can never be 100% accurate.

Returns: boolean

isSpreadInView

isSpreadInView(part?: "entire" | "left-page" | "right-page"): "entire" | "left-page" | "right-page" | "none"

Tells which part of the current spread is in view: entire, left-page, right-page or none.

Parameter Type Description
part? “entire” | “left-page” | “right-page” Optional: the specific part to check for.

Returns: “entire” | “left-page” | “right-page” | “none”

playAnimation

playAnimation(): Promise<void>

Plays animation

Returns: Promise<void>

redo

redo(): void

Executes a redo step if available.

Returns: void

redoCount

redoCount(): number

Returns number of available redo steps

Returns: number

reRender

reRender(): Promise<void>

Forces re-rendering of current document

Returns: Promise<void>

resizePrintess

resizePrintess(immediate?: boolean, focusSelection?: boolean, width?: number, height?: number, focusFormFieldId?: string): void

Trigger a resize and fit of the current page, can focus the selection alternatively.

Parameter Type Description
immediate? boolean Optional: Determines if resize should wait for a second or happens immediately
focusSelection? boolean Optional: Will zoom to current selection
width? number Optional: Overrides the retrieved offsetWidth of the printess container - helpful when animations are longer running
height? number Optional: Overrides the retrieved offsetHeight of the printess container - helpful when animations are longer running
focusFormFieldId? string Optional: Form field id to zoom to

Returns: void

resizePrintessExact

resizePrintessExact(immediate: boolean, focusSelection: boolean, size: iRect, focusFormFieldId?: string, alwaysCenterSpread?: boolean): Promise<void>

Trigger a resize and fit of the current page to an exact target rectangle instead of the measured container size. immediate and focusSelection behave like in resizePrintess().

Parameter Type Description
immediate boolean
focusSelection boolean
size iRect
focusFormFieldId? string
alwaysCenterSpread? boolean The default value is false

Returns: Promise<void>

setExternalTopOffset

setExternalTopOffset(value: number): void

Shifts the entire printess view up and down in pixels.

Parameter Type Description
value number

Returns: void

setZoomMode

setZoomMode(m: "spread" | "frame"): void

Tells printess the zoom mode to use for the next resize operation spread zooms to the entire page frame zooms to the selected frame(s)

Parameter Type Description
m “spread” | “frame”

Returns: void

showGridButton

showGridButton(): "on" | "off" | "hide"

Returns if UI should display a button to show and hide the alignment grid

Returns: “on” | “off” | “hide”

showKeyboardShortcuts

showKeyboardShortcuts(): boolean

Returns whether UI should show button to display Keyboard Shortcuts

Returns: boolean

showUndoRedo

showUndoRedo(): boolean

Returns if buyer ui should display undo and redo buttons

Returns: boolean

stopAnimation

stopAnimation(): Promise<void>

Stops animation

Returns: Promise<void>

toggleGrid

toggleGrid(): void

Toggles alignment grid

Returns: void

undo

undo(): void

Executes an undo step if available.

Returns: void

undoCount

undoCount(): number

Returns number of available undo steps

Returns: number

zoomIn

zoomIn(): void

Zoom in on spread visible

Returns: void

zoomOut

zoomOut(): void

Zoom out of spread visible

Returns: void

zoomToFrames

zoomToFrames(isMobile?: boolean): boolean

Retrieves information if the device is mobile or the screen is so small that zoom to frames is needed

Parameter Type Description
isMobile? boolean

Returns: boolean