Layouts & Snippets

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

addGapAround

addGapAround(): Promise<boolean>

If splitter frames are present on current spread this method adds a gap between all splitter-frames and the page border Returns true if successful

Returns: Promise<boolean>

alignSplitterClustersToDocMargin

alignSplitterClustersToDocMargin(): Promise<void>

Aligns all splitter clusters on current spread to document margins

Returns: Promise<void>

applyPhotoFrameSnippet

applyPhotoFrameSnippet(snippetUrl: string): Promise<void>

Applies the given photo-frame snippet to the currently selected frame

Parameter Type Description
snippetUrl string The Url of the snippet

Returns: Promise<void>

applySplitterCellSnippet

applySplitterCellSnippet(splitterSnippetUrl: string): Promise<void>

Replaces current splitter-cell with splitter-snippet content

Parameter Type Description
splitterSnippetUrl string

Returns: Promise<void>

canSplitSelectedFrames

canSplitSelectedFrames(): boolean

Tells if the current selection is part of a collage and accordingly influences the size of other images and own size when changing

Returns: boolean

convertSplitterCellToImage

convertSplitterCellToImage(): Promise<void>

Change a text snippet frame to an image frame in a photo collage

Returns: Promise<void>

convertSplitterCellToText

convertSplitterCellToText(): Promise<void>

Change an image frame to a text snippet frame in a photo collage

Returns: Promise<void>

currentSpreadSplitVariantId

currentSpreadSplitVariantId(): string | null

Returns the last applied collage split-variant id for the current spread

Returns: string | null

getAppliedLayouts

getAppliedLayouts(): Record<string, Record<string, appliedLayoutInfo>>

Returns information about the applied layout snippets per document per spread. The first level contains a mapping of document name to spread info. The second level (spreads) contains the mapping of spread name or id (in case the spread does not have a name set) to the layout info.

Returns: Record<string, Record<string, appliedLayoutInfo>>

getBackgroundColorProperties

getBackgroundColorProperties(): iExternalProperty[]

Returns all background Frame Color Properties

Returns: iExternalProperty[]

getDiscardedContentOnLayoutAppliation

getDiscardedContentOnLayoutAppliation(): Promise<Array<string>>

Checks whether the user has made any edits (only checks for added text frames for now) to the current spread that would be discarded by applying a new layout.

Returns: Promise<Array<string>> — An array of all content types that would be discarded on layout application.

getInitialLayoutCategoryName

getInitialLayoutCategoryName(categories?: iSnippetMenuCategory[] | null): string

Returns selected Layout Category Name that will initially be selected in the Buyer Side for Layout Snippets Can be empty string (and should be ignored) if not set via attach parameters

Parameter Type Description
categories? iSnippetMenuCategory[] | null default value null

Returns: string

getLastAppliedLayoutInfo

getLastAppliedLayoutInfo(): { snippetTemplateName: string, snippetDocName: string, snippetDocId: string, splitVariantId?: string | null } | null

Returns the layout snippet template and doc name for the current spread

Returns: { snippetTemplateName: string, snippetDocName: string, snippetDocId: string, splitVariantId?: string | null } | null

getLayoutSnippetFilterMenu

This method is deprecated.

getLayoutSnippetFilterMenu(): Promise<iSnippetMenuCategory[] | null>

Returns the filter menu for layout snippets.

Returns: Promise<iSnippetMenuCategory[] | null>

getLayoutSnippetKeywords

getLayoutSnippetKeywords(): Promise<Array<string>>

Retrieves available keywords for layout snippet search

Returns: Promise<Array<string>>

getLayoutSnippetProductTypes

getLayoutSnippetProductTypes(): Promise<Array<string>>

Retrieves available product types for layout snippet search

Returns: Promise<Array<string>>

getMatchingCollageLayouts

getMatchingCollageLayouts(images: iExternalImage[]): Promise<iExternalCollageLayout[]>

Returns a selection of all matching collage layouts

Parameter Type Description
images iExternalImage[] images to distribute

Returns: Promise<iExternalCollageLayout[]>

getMaxCollageImages

getMaxCollageImages(): number

Returns the maximum number of images in a single collage

Returns: number

getPhotoFrameSnippets

getPhotoFrameSnippets(): Promise<{ topics: Array<iSnippetMenuTopic>, snippets: Array<iExternalSnippet> }>

Get a list of all photo-frame-snippets

Returns: Promise<{ topics: Array<iSnippetMenuTopic>, snippets: Array<iExternalSnippet> }>

getSelectedLayoutTopicId

getSelectedLayoutTopicId(category?: iSnippetMenuCategory | null): string

Returns selected Layout Topic Id that will initially be selected in the Buyer Side for Layout Snippets

Parameter Type Description
category? iSnippetMenuCategory | null default value null

Returns: string

getSnippetFilterMenu

getSnippetFilterMenu(menuId: "layout" | "background" | "photobook-themes" | string): Promise<iSnippetMenuCategory[] | null>

Returns Filter Menu for Layout Snippets (“layout”) or for a menu-id passed in “menuId”

Parameter Type Description
menuId “layout” | “background” | “photobook-themes” | string

Returns: Promise<iSnippetMenuCategory[] | null>

getSplitterSnippets

getSplitterSnippets(): Promise<Array<iExternalSnippet>>

Get a list of all splitter-content-snippets

Returns: Promise<Array<iExternalSnippet>>

getTextFrameSnippets

getTextFrameSnippets(): Promise<{ topics: Array<iSnippetMenuTopic>, snippets: Array<iExternalSnippet> }>

Get a list of all text-frame-snippets

Returns: Promise<{ topics: Array<iSnippetMenuTopic>, snippets: Array<iExternalSnippet> }>

hasBackground

This method is deprecated.

hasBackground(): boolean

Indicates if the current spread has editable background frames.

Returns: boolean

hasBackgroundLayoutsTab

hasBackgroundLayoutsTab(): boolean

Indicates if the current spread has background layouts (background-tab feature)

Returns: boolean

hasLayoutSnippetImageCountFilter

hasLayoutSnippetImageCountFilter(): boolean

Returns if ui should show image count filter for layout snippets Only active if filter menu is displayed

Returns: boolean

hasLayoutSnippets

hasLayoutSnippets(): boolean

Returns if LayoutSnippets are available

Returns: boolean

hasPhotoFrameSnippets

hasPhotoFrameSnippets(): boolean

If the current selection should show photo-frame-styles (PanelUI only)

Returns: boolean

hasScissorMenu

hasScissorMenu(): "never" | "horizontical" | "vertical" | "both"

Indicates if a selected image frame can be splitted in certain directions

Returns: “never” | “horizontical” | “vertical” | “both”

hasSnippetMenu

hasSnippetMenu(which: "layout" | "sticker" | "background"): boolean

Returns if the snippet menu of the given type (“layout” | “sticker” | “background”) should be rendered

Parameter Type Description
which “layout” | “sticker” | “background”

Returns: boolean

hasSplitterMenu

hasSplitterMenu(): boolean

Indicates if a splitter cell is selected

Returns: boolean

hasSplitters

hasSplitters(): boolean

Returns if current spread has splitter frames

Returns: boolean

hasSplitterTextSnippets

hasSplitterTextSnippets(): boolean

Indicates if splitter text snippets are available

Returns: boolean

hasTextFrameSnippets

hasTextFrameSnippets(): boolean

If the current selection should show text-frame-styles (PanelUI only)

Returns: boolean

insertGroupSnippet

insertGroupSnippet(snippetUrl: string, targetSplitterBoxId?: string, autoAssignToSelectionIfPossible?: boolean): Promise<void>

Insert a Sticker (Group-Snippet) on the current spread of the current document

Parameter Type Description
snippetUrl string The Url of the snippet
targetSplitterBoxId? string
autoAssignToSelectionIfPossible? boolean The default value is false

Returns: Promise<void>

insertLayoutAndAssignImages

insertLayoutAndAssignImages(images: iExternalImage[], splitVariantId?: string | null, spreadId?: string): Promise<void>

Selects the best layout snippet for the passed images, inserts it and assigns the images to its frames.

Parameter Type Description
images iExternalImage[]
splitVariantId? string | null optional split-variant id of the collage layout to apply (see getMatchingCollageLayouts)
spreadId? string optional id of the target spread

Returns: Promise<void>

insertLayoutSnippet

insertLayoutSnippet(snippetUrl: string, targetPage?: "left" | "right" | "entire", spread?: any, colorScheme?: string, hideRemoveBorderOption?: boolean, splitVariant?: number, forceRepeat?: ForceSnippetPlacement, layoutImageSelection?: "apply" | "skip", removeBoxesOnBackgroundLayer?: boolean, addingBackgroundLayout?: boolean): Promise<void>

Insert a Layout-Snippet on the current spread of the current document

Parameter Type Description
snippetUrl string The Url of the snippet
targetPage? “left” | “right” | “entire” optional, forces layout-snippets to left or right side if aspect ratio of snippet matches dimensions a single page of a double page spread
spread? any
colorScheme? string
hideRemoveBorderOption? boolean optional, Default value is false
splitVariant? number
forceRepeat? ForceSnippetPlacement
layoutImageSelection? “apply” | “skip”
removeBoxesOnBackgroundLayer? boolean
addingBackgroundLayout? boolean

Returns: Promise<void>

insertTemplateAsLayoutSnippet

insertTemplateAsLayoutSnippet(templateName: string, templateVersion: "draft" | "published", documentName: string, mode: "layout" | "group"): Promise<void>

Insert a document from any template like a layout-snippet or group-snippet (sticker) to the current document/spread This method comes in handy if you have your own snippet-management in place. Any template can be inserted (Does not have to be published as snippet), but if the template/document is a snippet the placement-settings will be used

Parameter Type Description
templateName string
templateVersion “draft” | “published”
documentName string
mode “layout” | “group”

Returns: Promise<void>

isBackgroundSelected

isBackgroundSelected(): boolean

Indicates if background frames are selected

Returns: boolean

isLastAppliedLayout

isLastAppliedLayout(snippetUrl: string): boolean

Returns true if the snippet has been lastly applied on the current document

Parameter Type Description
snippetUrl string

Returns: boolean

loadBackgroundLayouts

loadBackgroundLayouts(): Promise<iExternalSnippet[]>

Loads all background layout snippets for the background-layouts tab (see hasBackgroundLayoutsTab)

Returns: Promise<iExternalSnippet[]>

loadBackgroundLayoutsByKeywords

loadBackgroundLayoutsByKeywords(keywords: string[], topicId?: string): Promise<Array<iExternalSnippet>>

Retrieves all background-layout snippets matching the given keywords

Parameter Type Description
keywords string[]
topicId? string

Returns: Promise<Array<iExternalSnippet>>

loadLayoutSnippetsByKeywords

loadLayoutSnippetsByKeywords(keywords: string[], topicId?: string): Promise<Array<iExternalSnippet>>

Retrieves all layout snippets matching the given keywords, current language and current aspect ratio

Parameter Type Description
keywords string[]
topicId? string

Returns: Promise<Array<iExternalSnippet>>

loadStickerSnippetsByKeywords

loadStickerSnippetsByKeywords(tags: string[] | ReadonlyArray<string>, keywords: string[]): Promise<Array<iExternalSnippet>>

Retrieves all sticker snippets matching the given tags & keywords and the current language

Parameter Type Description
tags string[] | ReadonlyArray<string>
keywords string[]

Returns: Promise<Array<iExternalSnippet>>

nextGapAction

nextGapAction(): { gapAround: null | "add" | "remove", gap: number, setGap: null | "all" | "only>0" }

Returns the next possible gap actions for the splitter layout on the current spread: whether a gap around the splitter frames can be added or removed (gapAround), the current gap value (gap) and which gap sizes may be set via setSplitterGaps (setGap: “all” includes a zero gap, “only>0” only positive sizes)

Returns: { gapAround: null | “add” | “remove”, gap: number, setGap: null | “all” | “only>0” }

removeGapAround

removeGapAround(): Promise<boolean>

If splitter frames are present on current spread this method removes the gap between all splitter-frames and the page border Returns true if successful

Returns: Promise<boolean>

selectBackground

selectBackground(): Promise<void>

Selects all frames which are marked as background

Returns: Promise<void>

setBackgroundColor

setBackgroundColor(colorIndex: number, propertyValue: string, mode: "page" | "all"): Promise<void>

Sets a background color property by index

Parameter Type Description
colorIndex number
propertyValue string
mode “page” | “all” apply the color to the current page (“page”) or to all pages (“all”)

Returns: Promise<void>

setSplitterGaps

setSplitterGaps(n: number): Promise<void>

Set the gap size of the photo grid

Parameter Type Description
n number gap size of the photo grid

Returns: Promise<void>

showLayoutSnippetColorSchemes

showLayoutSnippetColorSchemes(): boolean

Whether UI should show color schemes for layout snippets

Returns: boolean

splitFrame

splitFrame(direction: "horizontal" | "vertical"): Promise<void>

Split an image frame that has splitter option turned on

Parameter Type Description
direction “horizontal” | “vertical” is either horizontal or vertical depending on how an image should be splitted

Returns: Promise<void>

splitterEdgesCount

splitterEdgesCount(): number

number of active splitter edges

Returns: number

stickerCanReplaceFrame

stickerCanReplaceFrame(): boolean

returns if a selected sticker could replace the current selection

Returns: boolean

templateHasSnippets

templateHasSnippets(): boolean

returns if snippets are present on any spread in the template

Returns: boolean