List all pages and artboards
Once you import a design, you can fetch a list of all of the pages or artboards that are inside. Alternatively, you can find a specific page or artboard with a query.
List all pages
To list all pages, use the design.getPages() method on the design.
Here's an example snippet:
This returns an array of objects that looks like this:
With this data, you can get a page instance using its ID and do things like:
- Get a list of all artboards in that specific page
- Generate a PNG of the entire page using Render
- Get all fonts used in the page
List all artboards
To list all artboards, use the design.getArtboards() method on the design.
Here's an example snippet:
This returns an array of objects that looks like this:
With this data, you can get an artboard instance using its ID and do things like:
- Get the bounds of the artboard
- Generate a PNG of the artboard using Render
- Get the content of the artboard
Was this article helpful?
β