- Introduction
- What's New?
- Features
- Upgrading the Design Editor
- Breaking Changes in 6.0
- Getting Started
- Integration with E-commerce
- Integration with Remote Asset Sources
- Printable Files and Proof Images
- Configuring Products
- Creating Product Templates
- User Interface
- Configuration Files
- APIs
- Add-ons
- System Requirements
- Troubleshooting
- Migrating Your Applications
- Licensing
- Copyright Notices
Specifying Product Tags
Applies to: Customer's Canvas On-Premises; Design Editor 6.15.0, 6.x (may differ) · Archived documentation
You may want to tag your products with related details. Customer's Canvas supports two types of these details. First, you can provide them as PDF metadata in the hi-res output. Also, you can add tags as keywords to your product that can improve the product design process in the web-to-print editor.
PDF metadata
Customer's Canvas allows you to save five properties in PDF hi-res outputs:
- Author
- Creator
- Keywords
- Subject
- Title
You can both predefine these properties prior to loading the editor and specify them at runtime.
To predefine metadata, set up the hiResOutputPdfMetadata object for rendering through either the ~\Configuration\clientConfig.json file or the IPdfMetadata interface:
// Initialize the editor with the "Postcard.psd" template.
productDefinition = {
surfaces: ["Postcard"]
};
// Set up PDF metadata.
configuration = {
rendering: {
hiResOutputPdfMetadata: {
title: "The red postcard",
keywords: "red,flower,postcard"
}
}
};
CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition, configuration);
The setPdfMetadata and getPdfMetadata methods allow working with PDF metadata at runtime.
Tags
To pass attributes, which you may need at the moment of processing the ordered product, you can use tags. Customer's Canvas provides two ways of defining these tags: by using the Web API and IFrame API.
The Product.setTags method allows you to specify tags through the IFrame API. To read these tags, use the Product.getTags method. The following example shows how you can set product tags.
// The product is a postcard with a flower image in red colors.
var newTags = ["red", "flower", "postcard"];
editor.getProduct()
.then(function (product) {
product.setTags(newTags)
.catch(function (error) {
console.error("Setting tags failed with exception: ", error);
});
});
Here, you classify the product by the palette, image, and type.
Let us look at how you can set up mockups based on product tags at runtime. In the following example, we set up a foreground mockup for photos and a background mockup for cups.
var frameMockup = {
// Set up the foreground mockup "photoFrame.psd".
up: "photoFrame"
}
var cupMockup = {
// Set up the background mockup "paperCup.psd".
down: "paperCup"
}
editor.getProduct()
.then(function (product) {
product.getTags()
.then(function (tags) {
if (tags != null) {
// Set up the background mockup for cups.
if (tags.indexOf("cup") != -1) {
product.currentSurface.setMockup(cupMockup);
}
// Set up the foreground mockup for photos.
if (tags.indexOf("photo") != -1) {
product.currentSurface.setMockup(frameMockup);
}
}
})
.catch(function (error) {
console.error("Getting tags failed with exception: ", error);
});
});
See Also
Manual
- Introducing the IFrame API
- clientConfig.json configuration file
- Mockups
- Web API for manipulating product tags