Pages & Documents

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

adjustMargins

adjustMargins(settings: iExternalMarginSettings): Promise<void>

Adjusts margin settings on the current document.

Parameter Type Description
settings iExternalMarginSettings

Returns: Promise<void>

canDuplicateSpread

canDuplicateSpread(): boolean

Tells if user is allowed to duplicate the current spread

Returns: boolean

duplicateSpread

duplicateSpread(): Promise<boolean>

Duplicates the currently selected spread

Returns: Promise<boolean> — true if the spread was duplicated successfully

enterBookMookPreview

enterBookMookPreview(): Promise<void>

Enters the read-only page-flip book preview (“book mook”); switches to the book-cover document first if one exists.

Returns: Promise<void>

getAllDocsAndSpreads

getAllDocsAndSpreads(applyLockCoverInside?: boolean): Array<iExternalDocAndSpreadInfo>

Returns information about all spreads of ALL buyer-editable documents

Parameter Type Description
applyLockCoverInside? boolean (default is false) If set to “true” and the document has “lockCoverInside” enabled, the call returns the printed amount of spreads and pages

Returns: Array<iExternalDocAndSpreadInfo>

Used in these examples:

getAllSpreads

getAllSpreads(): Array<iExternalSpreadInfo>

Returns information about all spreads of the displayed document

Returns: Array<iExternalSpreadInfo>

getCurrentDocumentId

getCurrentDocumentId(): string

Retrieves current document id, returns empty string if doc is not yet loaded.

Returns: string

getCurrentSpreadSize

getCurrentSpreadSize(): { width: number, height: number } | null

Returns the current spread size including placement rect in pixel

Returns: { width: number, height: number } | null

getDocumentAspect

getDocumentAspect(): "landscape" | "portrait"

Returns the current documents aspect

Returns: “landscape” | “portrait”

getDocumentAspectRatioName

getDocumentAspectRatioName(): string

Returns the aspect-ratio name of the current spread (one of “ultra-portrait”, “super-portrait”, “portrait”, “square”, “landscape”, “super-landscape”, “ultra-landscape”), as used to match layout snippets to the spread aspect. Returns “not loaded” if the template is not fully loaded yet.

Returns: string

getDocumentSize

getDocumentSize(): { width: number, height: number } | null

Returns the current document size in pixel

Returns: { width: number, height: number } | null

getMargins

getMargins(): iExternalMarginSettings

Returns the current margin settings of the current document.

Returns: iExternalMarginSettings

hasBuyerContentEdits

hasBuyerContentEdits(spreadIdOrIndex?: string | number, documentName?: string): boolean

Returns true if the user has made edits on a spread.

Parameter Type Description
spreadIdOrIndex? string | number
documentName? string Optional document name; defaults to the current document

Returns: boolean

hasBuyerContentEditsInAnyDocumentOrFormField

hasBuyerContentEditsInAnyDocumentOrFormField(): boolean

Returns true if any document has buyer content edits on any spread, or if any text form field value has been changed from its default.

Returns: boolean

hasBuyerContentEditsLeftRight

hasBuyerContentEditsLeftRight(spreadIdOrIndex?: string | number, documentName?: string): { onLeftPage: boolean, onRightPage: boolean, onEntirePage: boolean }

Returns on what side of the spread the user has content edits

Parameter Type Description
spreadIdOrIndex? string | number
documentName? string Optional document name; defaults to the current document

Returns: { onLeftPage: boolean, onRightPage: boolean, onEntirePage: boolean }

isDoublePageSpread

isDoublePageSpread(): boolean

Check for double page spreads to show/hide zoom to spread option

Returns: boolean

isInBookMookPreview

isInBookMookPreview(): boolean

Tells UI if currently in Page Flip Book Mook Preview

Returns: boolean

isInReadOnlyBuyerMode

isInReadOnlyBuyerMode(): boolean

Tells UI if currently in Read Only Mode

Returns: boolean

leaveBookMookPreview

leaveBookMookPreview(): Promise<void>

Leaves the read-only page-flip book preview (“book mook”).

Returns: Promise<void>

mergeCurrentDocumentToTargetDocument

mergeCurrentDocumentToTargetDocument(targetDocId: string, frames: "all" | "snippets"): Promise<void>

Method to merge the current document content on another document of the current template

Parameter Type Description
targetDocId string The id of the document to merge on
frames “all” | “snippets” Which frames should be merged, default to “snippets” which means all frames placed as layout- or sticker-snippet. “all” will delete all frames in the target document before copying over the new frames.

Returns: Promise<void>

nextPage

nextPage(): Promise<void>

Moves Printess focus to next page if available. Focus on single pages not spreads.

Returns: Promise<void>

pageInfo

pageInfo(): Promise<{ current: number, max: number, isFirst: boolean, isLast: boolean, spreadId: string }>

Retrieves information about the currently selected page. Returns natural page-number (current) starting from 1 (not spread-index), page-count (max) and flags if the current page isFirst or isLast page of the current document First and last pages are identical to the spread in facing page documents. Async version waits for Printess to be fully loaded.

Returns: Promise<{ current: number, max: number, isFirst: boolean, isLast: boolean, spreadId: string }>

pageInfoSync

pageInfoSync(includeDocs?: boolean): { current: number, multiDoc: boolean, max: number, isFirst: boolean, isLast: boolean, spreadId: string, part: "left-page" | "right-page" | "entire", docId: string }

Retrieves information about the currently selected page. Returns natural page-number (current) starting from 1 (not spread-index), page-count (max) and flags if the current page isFirst or isLast page of the current document First and last pages are identical to the spread in facing page documents. Sync version returns dummy data if Printess is not fully loaded.

Parameter Type Description
includeDocs? boolean If set to true, multiDoc and the isFirst/isLast flags take all editable documents into account, not only the current document.

Returns: { current: number, multiDoc: boolean, max: number, isFirst: boolean, isLast: boolean, spreadId: string, part: “left-page” | “right-page” | “entire”, docId: string }

pageNavigationDisplay(): "hide" | "numbers" | "icons" | "doc-tabs"

Returns how the buyer ui should display the page navigation: hidden, as page numbers for the current doc, as icons (thumbnails) for all docs, or as doc-tabs.

Returns: “hide” | “numbers” | “icons” | “doc-tabs”

previousPage

previousPage(): Promise<void>

Moves Printess focus to previous page if available. Focus on single pages not spreads.

Returns: Promise<void>

resizeSubDocAndBox

resizeSubDocAndBox(newWidth: number, newHeight: number, boxToDocScale: number): Promise<boolean>

Looks for sub doc in current selection, resizes it and also resize referencing frame

Parameter Type Description
newWidth number
newHeight number
boxToDocScale number

Returns: Promise<boolean>

selectDocumentAndSpread

selectDocumentAndSpread(docIdOrName: string, spreadIndex: number, part?: "entire" | "left-page" | "right-page"): Promise<void>

Selects a document and a spread and brings it into view. spread-index is zero based and even a facing page counts as a single spread. You can pass the focus area in the part parameter.

Parameter Type Description
docIdOrName string ID or Name of document to select
spreadIndex number zero-based
part? “entire” | “left-page” | “right-page” “entire” | “left-page” | “right-page”

Returns: Promise<void>

Used in these examples:

selectLastDocument

selectLastDocument(): Promise<void>

Jumps back to last editable doc if in permanent group editing. Also used to return to the overview from a single-photo document opened via openSinglePhotoDoc().

Returns: Promise<void>

selectSpread

selectSpread(spreadIndex: number, part?: "entire" | "left-page" | "right-page"): Promise<void>

Selects a spread and brings it into view. spread-index is zero based and even a facing page counts as a single spread. You can pass the focus area in the part parameter.

Parameter Type Description
spreadIndex number zero-based
part? “entire” | “left-page” | “right-page” “entire” | “left-page” | “right-page”

Returns: Promise<void>

setDocumentBleed

setDocumentBleed(documentName: string, bleedInside: number, bleedTop: number, bleedOutside: number, bleedBottom: number): Promise<void>

Sets the four bleeds of a specific document. Values are in the document’s unit (e.g. 1 equals “1cm” when the document unit is cm). “inside”/“outside” are the binding-relative left/right edges for facing-page documents.

Parameter Type Description
documentName string Name of the document to change
bleedInside number Inside (spine-side) bleed
bleedTop number Top bleed
bleedOutside number Outside bleed
bleedBottom number Bottom bleed

Returns: Promise<void>

setDocumentSize

setDocumentSize(documentName: string, widthInDocUnit: number, heightInDocUnit: number): Promise<void>

Sets the size of a specific document

Parameter Type Description
documentName string Name of the document to change
widthInDocUnit number 12 equals e.g. “12cm”
heightInDocUnit number 12 equals e.g. “12cm”

Returns: Promise<void>

showPageNavigation

This method is deprecated.

showPageNavigation(): boolean

Returns if buyer ui should display the page navigation

Returns: boolean

spreadCount

spreadCount(): number

Returns total number of spreads (not pages)

Returns: number