Platform:
Language:
Apply a Template to a Scene
In this example, we will show you how to use the CreativeEditor SDK's CreativeEngine to apply the contents of a given template scene to the currently loaded scene through the scene
API.
Setup#
This example uses the headless CreativeEngine. See the Setup article for a detailed guide.
To get started right away, you can also access the block
API within a running CE.SDK instance via cesdk.engine.block
.
Check out the APIs Overview to see that illustrated in more detail.
Applying Template Scenes#
applyTemplateFromString(content: string): Promise<void>
Applies the contents of the given template scene to the currently loaded scene.
This loads the template scene while keeping the design unit and page dimensions of the current scene. The content of the pages is automatically adjusted to fit the new dimensions.
applyTemplateFromURL(url: string): Promise<void>
Applies the contents of the given template scene to the currently loaded scene.
This loads the template scene while keeping the design unit and page dimensions of the current scene. The content of the pages is automatically adjusted to fit the new dimensions.
get(): number
returns the id of the current scene.
File:
engine.scene.applyTemplateFromString("UBQ1ewoiZm9ybWF0Ij...");engine.scene.applyTemplateFromURL('https://cdn.img.ly/packages/imgly/cesdk-js/latest/assets/templates/cesdk_postcard_1.scene');