onArtworkCreate

Registers a callback that runs when a user finishes proofing their design.

onArtworkCreate is deprecated. It's superseded by onMultiArtworkCreate. onMultiArtworkCreate is in a closed, invite-only beta. If you're not participating in the beta program, you can continue to use onArtworkCreate until onMultiArtworkCreate is launched for all partners.

The Partnership SDK refers to a proofed design as an artwork.

Usage

(async () => {
const api = await Canva.Partnership.initialize({
apiKey: "<partner_api_key>",
autoAuthToken: "<auto_auth_token>",
container: document.getElementById("container"),
});
const onArtworkCreate = (opts) => {
// the user has finished proofing their design
console.log(opts);
};
const onProductSelect = (opts) => {
api.createDesign({
...opts,
onArtworkCreate,
});
};
api.showCatalog({
onProductSelect,
});
})();

Parameters

To understand the meaning of the Volatile column, see the definition of Volatile parameters in the Glossary.

Name

Type

Required

Volatile

Description

opts

object

Yes

N/A

Information about the user's proofed design.

opts.previewImages

Array

Yes

Yes

A list of URLs for previewing a low-resolution version of the artwork. For JPG and PNG file formats, there's a separate URL for each page. For PDF file formats, there's one URL for the entire preview. The URL is in the form https://partnership-artwork.canva.com/<export_file>. If you're using the China version of the SDK, the TLD is .cn instead of .com. You can take the necessary security measures to protect the URL from any malicious attacks.

opts.previewImageSrc (deprecated)

string

Yes

Yes

The URL of a low-resolution preview of the artwork. This parameter is superseded by opts.previewImages.

opts.artworkId

string

Yes

No

The ID of the user's artwork.

opts.artworkTitle

string

Yes

No

The title of the user's artwork.

opts.pageCount

number

Yes

No

The number of the pages in the artwork.

opts.partnerProductId

string

Yes

No

The ID of a product in the partner's backend.