Search
Loading...
Skip to content

Import Templates

Load design templates into CE.SDK from archive URLs, scene URLs, and serialized strings.

Import Templates

5 mins
estimated time
Download
StackBlitz
GitHub

Templates are pre-designed scenes that provide starting points for user projects. CE.SDK supports loading templates from archive URLs with bundled assets, remote scene URLs, or serialized strings stored in databases.

This guide covers how to load templates from archives, URLs, and strings, and work with the loaded content.

Load from Archive#

Load a template from an archive URL using loadFromArchiveURL(). Archives are .zip files that bundle the scene with all its assets, making them portable and self-contained.

// Load template from archive URL (bundled assets)
await engine.scene.loadFromArchiveURL(fashionAdArchiveUrl);

Load from URL#

Load a template from a remote .scene file URL using loadFromURL(). The scene file is a JSON-based format that references assets via URLs.

// Load template from a scene file URL
await engine.scene.loadFromURL(postcardSceneUrl);

Load from String#

For templates stored in databases or received from APIs, load from a serialized string using loadFromString(). This method works with content previously saved using engine.scene.saveToString().

// Load template from serialized string
await engine.scene.loadFromString(businessCardSceneString);

Working with the Loaded Scene#

After loading a template, you can verify its contents and adjust the viewport.

Verify the Scene#

Use engine.scene.get() to retrieve the scene block and engine.scene.getPages() to inspect its pages.

// Verify the loaded scene
const loadedScene = engine.scene.get();
if (loadedScene != null) {
const pages = engine.scene.getPages();
// eslint-disable-next-line no-console
console.log(`Template loaded with ${pages.length} page(s)`);
}

Zoom to Content#

Fit the loaded template in the viewport using zoomToBlock() with optional padding.

// Zoom viewport to fit the loaded scene
const scene = engine.scene.get();
if (scene != null) {
await engine.scene.zoomToBlock(scene, { padding: 40 });
}