You’re viewing outdated documentation. View the latest Customer’s Canvas On-Premises documentation.

IDataSet Interface

Applies to: Customer's Canvas On-Premises; Design Editor 6.15.0, 6.x (may differ) · Archived documentation

A structure defining the personalization data and a new product configuration. For details, see the Personalized Rendering topic.

This interface provides a more flexible approach than itemsData and allows you to use products as templates.

example
const productDefinition = { surfaces: ["badge"] };
const data = {
    dataSet: {
        surfacesData: [{
            // Define the pages that will be rendered to the resulting print file.
            surfaceBinding: {
                // Render only the first product page.
                surfaceIndexes: [0]
            },
            // Define the personalization data.
            data: [
                // Render two copies with the personalized Name field.
                {
                    "Name": {
                        text: "Cristopher Bennett",
                        color: "rgb(48, 194, 255)"
                    }            
                },
                {
                    "Name": {
                        text: "John Wood",
                        color: "rgb(48, 194, 255)"
                    }            
                }
            ]
        }]
    }
};
// Load the editor.
CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition)
    .then(editor => {
        // Personalize the loaded product.
        editor.finishProductDesign(null, data)
        // Output links to the resulting print files.
        .then(result => console.log(result.hiResOutputUrls));
    });

Properties

surfacesData

surfacesData: ISurfaceData []

A set of required surfaces and data to personalize these surfaces.