Adds a new page immediately after the currently selected page.
Parameters
Configuration for the new page to be added.
Properties of opts
The page background. This can be a solid color, an image or a video.
Properties of background
An image or video to use as the fill.
The color of the fill as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
" #ff0099"
Elements to be added to the page
The type has been superseded by ElementAtPoint
.
An element that's natively supported by the Canva editor and has positional properties.
The type has been superseded by ImageElementAtPoint
.
An element that renders image content and has positional properties.
A description of the image content.
The type of element.
This must be "image"
.
A data URL that contains the image data.
A unique identifier that points to an image asset in Canva's backend.
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
A rotation, in degrees.
- Minimum: -180
- Maximum: 180
A height, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
A width, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
The type has been superseded by VideoElementAtPoint
.
An element that renders video content and has positional properties.
A description of the video content.
A unique identifier that points to a video asset in Canva's backend.
The type of element.
This must be "video"
.
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
A rotation, in degrees.
- Minimum: -180
- Maximum: 180
A height, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
A width, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
The type has been superseded by EmbedElementAtPoint
.
An element that renders rich media, such as a YouTube video, and has positional properties.
The type of element.
This must be "embed"
.
The URL of the rich media.
This URL must be supported by the Iframely API.
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
A rotation, in degrees.
- Minimum: -180
- Maximum: 180
A height, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
A width, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
The type has been superseded by TextElementAtPoint
.
An element that renders text content and has positional properties.
The text content.
Only the first element in this array is used.
The distance from the left edge of the container, in pixels.
- Minimum: -32768
- Maximum: 32767
The distance from the top edge of the container, in pixels.
- Minimum: -32768
- Maximum: 32767
The type of element.
This must be "text"
.
The rotation of the element, in degrees.
- Minimum: -180
- Maximum: 180
The width of the element, in pixels.
- Minimum: 0
- Maximum: 32767
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the font.
Default Value: "none"
The available options include:
"none"
"underline"
A unique identifier that points to a font asset in Canva's backend.
The size of the text.
- Minimum: 1
- Maximum: 100
Default Value: 16
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
The alignment of the text.
Default Value: "start"
The available options include:
"start"
"center"
"end"
"justify"
The type has been superseded by ShapeElementAtPoint
.
An element that renders a vector shape and has positional properties.
The paths that define the structure of the shape.
- There must be between 1 and 30 paths (inclusive).
- The maximum combined size of all paths must not exceed 2kb.
- The maximum number of unique fill colors across all paths is 6.
Properties of paths
The shape of the path.
This is similar to the d
attribute of an SVG's path
element, with some limitations:
- The path must start with an M command.
- The path must not have more than one M command.
- The path must not use the Q command.
- The path must be closed, either by:
- Using a Z command at the end of the path
- Having the last coordinate match the first coordinate
The appearance of the path's interior.
Properties of fill
An image or video to use as the fill.
The color of the fill as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
" #ff0099"
If true
, users can replace a fill by dropping an image or video onto it.
The outline of the path.
Properties of stroke
The color of the stroke as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The alignment of the stroke.
This must be "inset"
.
The weight (thickness) of the stroke.
- Minimum: 0
- Maximum: 100
The type of element.
This must be "shape"
.
Options for configuring the scale and cropping of a shape.
Properties of viewBox
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
A rotation, in degrees.
- Minimum: -180
- Maximum: 180
A height, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
A width, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
The type has been superseded by GroupElementAtPoint
.
An element that contains two or more elements and has positional properties.
The elements to render within the group.
- Each element within a group must have dimensions and a position.
- The dimensions and positions are relative to the dimensions and positions of the group.
The type of element.
This must be "group"
.
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
- Minimum: -32768
- Maximum: 32767
A rotation, in degrees.
- Minimum: -180
- Maximum: 180
A height, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
A width, in pixels.
- The pixels are relative to their container.
- Minimum: 0
- Maximum: 32767
An element that renders richtext content.
This type includes properties for controlling the position and dimensions of the element. It will be positioned and sized relative to its parent container. The parent container may be an app element, or the current page.
The richtext content.
Properties of range
Appends the specified characters to the end of the range.
Parameters
The characters to append to the richtext range.
Options for formatting inline richtext.
Properties of formatting
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the text.
Default Value: "none"
The available options include:
"none"
"underline"
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
The available font weights depend on the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
An external URL that the text links to.
The strikethrough of the text.
Default Value: "none"
The available options include:
"none"
"strikethrough"
Returns
Formats all of the paragraphs that overlap the given bounds.
- The
\n
character indicates the end of a paragraph. - All paragraphs that overlap the provided bounds will be formatted in their entirety.
Parameters
The formatting to apply to the paragraph(s).
Properties of formatting
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the text.
Default Value: "none"
The available options include:
"none"
"underline"
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
The available font weights depend on the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
An external URL that the text links to.
The strikethrough of the text.
Default Value: "none"
The available options include:
"none"
"strikethrough"
A unique identifier that points to a font asset in Canva's backend.
The size of the text, in pixels.
- In the Canva editor, this number is shown as points (pts), not pixels.
- Minimum: 1
- Maximum: 100
The list indentation level of the paragraph.
The appearance of list item markers.
This property only has an effect if listLevel
is greater than 0.
Default Value: "none"
The available options include:
"none"
"disc"
"circle"
"square"
"decimal"
"lower-alpha"
"lower-roman"
"checked"
"unchecked"
The alignment of the text.
Default Value: "start"
The available options include:
"start"
"center"
"end"
"justify"
Returns
void
Formats a region of text with inline formatting properties.
Parameters
The formatting to apply to the text.
Properties of formatting
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the text.
Default Value: "none"
The available options include:
"none"
"underline"
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
The available font weights depend on the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
An external URL that the text links to.
The strikethrough of the text.
Default Value: "none"
The available options include:
"none"
"strikethrough"
Returns
void
Returns the current state of the richtext as plaintext.
Returns
string
Replaces a region of text with the specified characters.
Parameters
The replacement characters.
The formatting to apply to the replaced text.
Properties of formatting
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the text.
Default Value: "none"
The available options include:
"none"
"underline"
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
The available font weights depend on the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
An external URL that the text links to.
The strikethrough of the text.
Default Value: "none"
The available options include:
"none"
"strikethrough"
Returns
The type of element.
This must be "richtext"
.
The distance from the left edge of the container, in pixels.
- Minimum: -32767
- Maximum: 32767
The distance from the top edge of the container, in pixels.
- Minimum: -32767
- Maximum: 32767
The rotation, in degrees.
- Minimum: -180
- Maximum: 180
The width, in pixels.
- Minimum: 0
- Maximum: 32767
A page title which must be no longer than 255 characters
Returns
Promise<void>