@express-document-sdk / PageNode
Class: PageNode
A PageNode represents a page in the document, a child of the root node of the document's "scenegraph" artwork tree (see ExpressRootNode). A page contains one or more artboards, which in turn contain all the page's visual content. If multiple artboards are present, each represents a keyframe "scene" in the page's animation timeline.
To create new pages, see PageList.addPage.
Extends
Implements
Accessors
addOnData
• get addOnData(): AddOnData
Get AddOnData reference for managing the private metadata on this node for this add-on.
Returns
allChildren
• get allChildren(): Readonly<Iterable<BaseNode, any, any>>
Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
GroupNode also provide a mutable ContainerNode.children list. Other nodes with a more specific structure can
hold children in various discrete "slots"; this allChildren list includes all such children and reflects their
overall display z-order.
Although BaseNode's allChildren may yield other BaseNodes, the subclasses Node and ArtboardNode override allChildren to guarantee all their children are full-fledged Node instances.
Returns
Readonly<Iterable<BaseNode, any, any>>
allDescendants
• get allDescendants(): Readonly<Iterable<VisualNode, any, any>>
IMPORTANT: This is currently experimental only and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the experimentalApis flag to true in the requirements section of the manifest.json.
Helper to recursively traverse all the exposed scenegraph content within the subtree of this node. Every container node and every leaf node will be visited via a pre-order tree traversal. Although once called the list of direct descendants is static, changes to further descendants may appear while iterating depending on when the operation occurs relative to the parent being yielded. Note that the root node (i.e. what this API was called on) is not visited.
Warning: Processing text content via this API can be error-prone. Use VisualNode.allTextContent
Returns
Readonly<Iterable<VisualNode, any, any>>
allTextContent
• get allTextContent(): Readonly<Iterable<TextContent, any, any>>
IMPORTANT: This is currently experimental only and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the experimentalApis flag to true in the requirements section of the manifest.json.
Helper to process all text content that is found as part of or within this node. This can be hard to do correctly via manual tree traversal since multiple ThreadedTextNode can share a single TextContentModel.
This iterator returns a single result per TextContentModel that is at least partially displayed within this node, even if that content is split across several separate TextNode "frames". If this node is or contains some but not all of the display frames of an overall TextContentModel, that model is still included as a result.
Note that visibleRanges and visibleText may not be sorted as TextNode "frames" can appear in any order in the scenegraph.
Returns
Readonly<Iterable<TextContent, any, any>>
artboards
• get artboards(): ArtboardList
The artboards or "scenes," which hold the page's visual contents. If multiple artboards are present, this list represents an ordered keyframe sequence in the page's animation timeline. To create new artboards, see ArtboardList.addArtboard.
Returns
height
• get height(): number
The height of the node.
All Artboards within a page share the same dimensions, so changing this value will also automatically adjust the size of every child ArtboardNode.
Must be at least MIN_PAGE_DIMENSION and no larger than MAX_PAGE_DIMENSION.
• set height(value): void
Parameters
• value: number
Returns
number
id
• get id(): string
A unique identifier for this node that stays the same when the file is closed & reopened, or if the node is moved to a different part of the document.
Returns
string
name
• get name(): undefined | string
The page's name. Displayed as a user-editable label above the current artboard in the UI.
• set name(name): void
Parameters
• name: undefined | string
Returns
undefined | string
parent
• get parent(): undefined | BaseNode
The node's parent. The parent chain will eventually reach ExpressRootNode for all nodes that are part of the document content.
Nodes that have been deleted are "orphaned," with a parent chain that terminates in undefined without reaching the
root node. Such nodes cannot be selected, so it is unlikely to encounter one unless you retain a reference to a node
that was part of the document content earlier. Deleted nodes can be reattached to the scenegraph, e.g. via Undo.
Returns
undefined | BaseNode
type
• get type(): SceneNodeType
The node's type.
Returns
width
• get width(): number
The width of the node.
All Artboards within a page share the same dimensions, so changing this value will also automatically adjust the size of every child ArtboardNode.
Must be at least MIN_PAGE_DIMENSION and no larger than MAX_PAGE_DIMENSION.
• set width(value): void
Parameters
• value: number
Returns
number
Methods
cloneInPlace()
• cloneInPlace(): PageNode
Clones this page, all artboards within it, and all content within those artboards. The cloned page is the same size as the original. Adds the new page immediately after this one in the pages list. The first artboard in the cloned page becomes the default target for newly inserted content (Context.insertionParent) and the viewport switches to display this artboard.
Returns
the cloned page.
removeFromParent()
• removeFromParent(): void
Removes the node from its parent - effectively deleting it, if the node is not re-added to another parent before the document is closed.
If parent is a basic ContainerNode, this is equivalent to node.parent.children.remove(node). For nodes with other
child "slots," removes the child from whichever slot it resides in, if possible. Throws if the slot does not permit
removal. No-op if node is already an orphan.
Returns
void



