Launched in Preview: Add a page

We’re excited to bring you a highly requested featured, now available under @canva/preview. Available now, you can Add New Pages to your design with the Canva Apps SDK! :rocket:

As a reminder all apps that use Preview features are not eligible for release the Canva Apps Marketplace.

Under @canva/preview/design, there are 2 new methods to support Adding New Pages:

  • design.addPage, which allows adding a page with pre-populated elements. See docs here.
  • design.getDefaultPageDimensions which retrieves the default dimensions of a new page in the design. See docs here.

Rebase or clone the starter kit repo to find the latest examples for working with Adding a Page. :heavy_plus_sign: :page_with_curl:

We know this will help in programmatically adding new pages to designs with your apps. Design whole pages in the side panel and add the new page to existing designs. Use the default dimensions to know how and where to place elements on the new page. We can’t wait to see what you create!

As always, please share any feedback on the APIs and Methods under @canva/preview as these early releases are your chance to help shape the future of Canva Developers. :sparkles:

11 Likes

Could support be added to allow developers to define where the page will be added? Maybe something like a “position” property that allows for “first” or “start”, “current”, “last” or “end”. I think being able to create pages at the end of the document would be most useful.

And a property like “atIndex” that takes an integer would also be nice. But I don’t think there’s a way currently to know how many pages are in the document, so that may not be useful for now.

3 Likes

Thanks for the feedback Eddie!
I’ll look into this improvement for the API, you mentioned that the end would be most useful, what kind of use cases are you thinking about here?

Also I agree, Ideally we could do “atIndex”.

1 Like

In the longer term to add report data to the end of a document after doing some analysis on the design.

1 Like

Another request would be to add an optional “title” property to the addPage method.

1 Like