Skip to main content
Platform
Language

Save Scenes to a String

In this example, we will show you how to save scenes as a string with the CreativeEditor SDK.

Explore a full code sample of the integration on CodeSandbox or view the code on GitHub.

CreativeEditor SDK allows you to save scenes in a binary format to share them between editors or store them for later editing. This is done by converting the contents of a scene to a single string, which can then be stored or transferred.

Warning#

A scene file does not include any fonts or images. Only the source URIs of assets, the general layout, and element properties are stored. When loading scenes in a new environment, ensure previously used asset URIs are available.

To get hold of such a string, you need to use engine.scene.saveToString(). This is an asynchronous method returning a Promise. After waiting for the Promise to resolve, we receive a plain string holding the entire scene currently loaded in the editor. This includes all pages and any hidden elements, but none of the actual asset data.

The returned string consists solely of ASCII characters and can safely be used further or written to a database.