requestExport
Exports the user's design as one or more static files.
To learn more, see Exporting designs.
Usage
import { requestExport } from "@canva/design";const response = await requestExport({acceptedFileTypes: ["PNG", "JPG"],});if (response.status === "COMPLETED") {console.log(response); // => { status: "COMPLETED", title: "My design", exportBlobs: [{ url: "https://example.com/image.png" }] }} else {console.log("The user exited the export flow.");console.log(response); // => { status: "ABORTED" }}
Rate limit
This method has a rate limit of 10 requests every 10 seconds.
Parameters
options
object
The options for configuring the export of a design.
options.acceptedFileTypes
array
The types of files the user can export their design as.
You must provide at least one file type.
The supported file types include:
"GIF"
"JPG"
"PDF_STANDARD"
"PNG"
"PPTX"
"SVG"
"VIDEO"
Returns
A Promise
that resolves with the following object:
result
object
The result of the successful export of a design.
result.status
string
A value that identifies if the export was successful or not.
This property may contain any of the following values:
"COMPLETED"
- The user successfully exported their design."ABORTED"
- The user closed the export dialog without exporting their design.
result.title
string
The title of the design, if it had been set by the user.
result.exportBlobs
array
The exported files.
If there are multiple files, they'll be provided in a ZIP file and the array will contain one item. In the future, there'll be an option for each file to be a separate item in the array.
result.exportBlobs[0].url
string
The URL of the exported file, such as a ZIP or PNG file.
If the user's design contains multiple pages but is exported in a format that doesn't support multiple pages, the URL will point to a ZIP file that contains each page as a separate file.
The following file types support multiple pages:
"GIF"
"PDF_STANDARD"
"PPTX"
"VIDEO"
The following file types do not support multiple pages:
"JPG"
"PNG"
"SVG"
If a user selects the "VIDEO"
option, they have the choice of exporting each page as a separate file. In this case, the URL will point to a ZIP file that contains a separate video for each page.