API reference
Design
addAudioTrackaddElementAtCursoraddElementAtPointaddNativeElementaddPagecreateRichtextRangeeditContentgetCurrentPageContextgetDefaultPageDimensionsgetDesignMetadatagetDesignTokeninitAppElementopenDesignoverlay.registerOnCanOpenrequestExportselection.registerOnChangesetCurrentPageBackgroundui.startDragToCursorui.startDragToPointui.startDrag
Intents: data
Intents: design
Platform
appProcessappProcess.broadcastMessageappProcess.currentappProcess.current.getInfoappProcess.current.requestCloseappProcess.current.setOnDisposeappProcess.requestCloseappProcess.registerOnMessageappProcess.registerOnStateChangefeatures.isSupportedfeatures.registerOnSupportChangegetPlatformInfonotification.addToastrequestOpenExternalUrl
getCurrentPageContext
API reference for the getCurrentPageContext method.
Allows to get the context of currently selected page.
Usage: Get current page information
import { getCurrentPageContext } from "@canva/design";const pageContext = await getCurrentPageContext();if (pageContext.dimensions) {// Do something with the page dimensions, e.g. `pageContext.dimensions.width` and `pageContext.dimensions.height`} else {// This page type does not have fixed dimensions, e.g. Whiteboard or Doc}
TYPESCRIPT
Returns
Page context of currently selected page. This is a Promise that resolves with the following object:
dimensionsPageDimensions | undefinedThe dimensions of the page, in pixels.
This may be undefined because some types of pages don't have dimensions, such as whiteboards.
widthnumberThe width of the page, in pixels.
heightnumberThe height of the page, in pixels.