This is an old documentation. Go to the latest Customer's Canvas docs

preload Function


  • preload( ) : void
  • Preloads resources of the web-to-print editor.

    <!DOCTYPE html>
    <html lang="en">
        <meta charset="utf-8" />
        <title>Customer's Canvas Quick Start Sample Page</title>
        <!-- The IFrame API script. IMPORTANT! Do not remove or change the ID. -->
        <script id="CcIframeApiScript" type="text/javascript" src="/cc/Resources/Generated/IframeApi.js">
        <!-- Preloading resources of the editor. -->
        <!-- The iframe to display the editor in. -->
        <iframe id="editorFrame" width="100%" height="800px"></iframe>
        // Initializing a product with only one template - "BusinessCard.psd".
        var productDefinition = { surfaces: ["BusinessCard"] };
        // Providing the tokenId, which is required in the Secure Mode.
        var config = { tokenId: "95c16577-75fe-4145-87ff-c0ba49d1a554" };
        // Getting the iframe element to display the editor in.
        var iframe = document.getElementById("editorFrame");
        var editor = null;
        // Loading the editor.
        CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition, config)
            // If the editor has been successfully loaded.
            .then(function (e) {
                editor = e;
            // If there was an error thrown when loading the editor.
            .catch(function (error) {
                console.error("The editor failed to load with an exception: ", error);

    Returns void