Design Editor IFrame API reference
Use the Design Editor IFrame API for complex configurations, for example, multipage products. You can configure the Design Editor and print products flexibly, and change a product configuration at runtime — add or remove surfaces, change mockups, and more.
To use the Design Editor IFrame API, link the IframeApi.js script located in ~/Resources/Generated/. Also, specify a URL that leads to the Design Editor instance — either add id="CcIframeApiScript" to the script tag or set the IframeApi.editorUrl property. Here is the simplest way to enable the IFrame API on your page.
<head>
<meta charset="utf-8" />
<!-- The IFrame API script. IMPORTANT! Do not remove or change the ID. -->
<script id="CcIframeApiScript" type="text/javascript" src="http://example.com/Resources/Generated/IframeApi.js">
</script>
</head>
<body>
<!-- The iframe to display the editor in. -->
<iframe id="editorFrame"></iframe>
</body>
<script>
...
//Loading the editor.
CustomersCanvas.IframeApi.loadEditor(iframe, ...);
</script>
The key function of the IFrame API is loadEditor. It displays the web-to-print editor in the given <iframe> element, loads the given product to the editor, and configures the editor. The two mandatory parameters here are the IFRAME element of the HTMLIFrameElement type and a product to load into the editor. The product should be defined via the IProductDefinition interface. For details, refer to the quick start example.
What you can do
- Start with the quick start to load an editor on a page.
- Describe products and surfaces in Product definition.
- Tune the editor in Editor configuration.
- Call the server-side endpoints from the Design Editor Web API.
Reference sections
- Design Editor IFrame API objects — classes, interfaces, enums, and type aliases.