Solved! Go to Solution.
var poolFeatureLayer = new esri.layers.FeatureLayer(permitUrl, { "mode": esri.layers.FeatureLayer.MODE_SNAPSHOT, //make sure the layer you wish to add to the legend includes an id to pass to legendLayers "id": "PoolPermits" }); // create a print template for each choice templates = dojo.map(templateNames, function(ch) { var plate = new esri.tasks.PrintTemplate(); var legendLayer = new esri.tasks.LegendLayer(); //set the layerId property for legendLayer legendLayer.layerId = "PoolPermits"; //legendLayer.subLayerIds = []; plate.layout = plate.label = ch; plate.format = "PDF"; plate.layoutOptions = { "authorText": "May by: Esri's JS API Team", "copyrightText": "<copyright info here>", "titleText": "Pool Permits", "scalebarUnit": "Miles", //this property needs to be set with an array of legendLayer objects, not layerIds "legendLayers": [legendLayer], }; return plate; });var myLegendLayer = new esri.tasks.LegendLayer();
myLegendLayer.layerId = "Boundaries";
myLegendLayer.subLayerIds = [];
app.printer = new esri.dijit.Print({
map: app.map,
templates: [{
label: "Layout",
format: "JPG",
layout: "Letter ANSI A Landscape",
preserveScale: false,
layoutOptions: {
titleText: "My Print",
authorText: "esri",
copyrightText: "My Company",
scalebarUnit: "Miles",
legendLayer: myLegendLayer
}
}
],
url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
}, dojo.byId("printButton"));
var poolFeatureLayer = new esri.layers.FeatureLayer(permitUrl, { "mode": esri.layers.FeatureLayer.MODE_SNAPSHOT, //make sure the layer you wish to add to the legend includes an id to pass to legendLayers "id": "PoolPermits" }); // create a print template for each choice templates = dojo.map(templateNames, function(ch) { var plate = new esri.tasks.PrintTemplate(); var legendLayer = new esri.tasks.LegendLayer(); //set the layerId property for legendLayer legendLayer.layerId = "PoolPermits"; //legendLayer.subLayerIds = []; plate.layout = plate.label = ch; plate.format = "PDF"; plate.layoutOptions = { "authorText": "May by: Esri's JS API Team", "copyrightText": "<copyright info here>", "titleText": "Pool Permits", "scalebarUnit": "Miles", //this property needs to be set with an array of legendLayer objects, not layerIds "legendLayers": [legendLayer], }; return plate; });