setPrintAreas Method

Callable

  • Sets a new print area for the surface and returns a new product instance containing the changed surface.

    By default, setPrintAreas moves only texts and image placeholders to new positions and drops other design elements. Note that this method changes the content of placeholders having the same layer names on the current Surface and in the new layout. To maintain the rest elements, set the replaceAll option to true. In this case, the rest of placeholders take content in a random order according to their type. If the old layout had more placeholders than the new layout, then extra placeholders are removed.

    If the current print area and the new print area have different sizes, you can specify whether to update the surface size to match the new print area by using the updateSurfaceSize option.

    example
    var newPrintAreas = [{ designFile: "stamp" }];
    var options = { 
        replaceAll: true,
        preserveSafetyLines: false,
        updateSurfaceSize: true
    };
    editor.getProduct()
        .then(function (product) {
            return product.surfaces[0].setPrintAreas(newPrintAreas, options);
        })
        .then(function (product) {
            console.log("The print area was successfully set for the product " + product.id);
        })
        .catch(function (error) {
            console.error("Failed to set up the print area: ", error);
        });
    

    Parameters

    Returns Promise < Product >

    A new product instance containing the changed surface.