AnsweredAssumed Answered

Customize the PrintTemplate

Question asked by David.Kucharski@23 on Sep 11, 2018
Latest reply on Sep 13, 2018 by rscheitlin

I have 2 Graphic Layers that I add to my map.


var colorOverlayLyr = new GraphicsLayer({ opacity: 0.5 });
var locationOverlayLyr = new GraphicsLayer({ opacity: 0.5 });


var map = new Map({
basemap: basemapDefault,
layers: [colorOverlayLyr, locationOverlayLyr] 


I add graphics to the colorOverlayLyr using the QueryTask, I do this for 5 colors, only the Blue code is included but the other colors are the same. They all are added to the colorOverlayLyr.

params.where = "ID_ IN (" + blue.value + ")";


function getBlueResults(response) {
var peakResults =, function (
feature) {

feature.symbol = {
type: "simple-fill", // autocasts as new PointSymbol3D()
color: {
r: 0,
g: 0,
b: 255,
a: 0.5
style: "solid",
opacity: 0.2,
outline: { color: "black", width: 1 }

return feature;




I add Graphics to the locationOverlayLyr. The user has the option to add up to 5 different locations on the map. This code is used passing in the different styles. 

var symbolBlack = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
style: values[0],
color: values[1],
size: "8px",
outline: {
color: values[1]


var point = {
type: "point", 
longitude: values[9],
latitude: values[8]

var lineAtt = {
Name: values[2],
Number: values[3],
Display: values[4]

var pointGraphic = new Graphic({
geometry: point,
symbol: symbolBlack,
attributes: lineAtt


The layers come out on the map. I then use the PrintTask to allow a user to print the map. I want to customize the Legend so the user knows exactly what is on the map. I use the LegendLayer to tell what layers to show but I do know know how to customize the description that comes out for the Graphics/Features that are displayed. I can customize the title of the actual layer but the individual graphics I don't know how to. They system shows some default values. How can I change those descriptions.


var printTask = new PrintTask({
url: ""


var colorlegendLayer = new LegendLayer();
colorlegendLayer.layerId =;
colorlegendLayer.title = "Color: This is the color";


var locationlegendLayer = new LegendLayer();
locationlegendLayer.layerId =;
locationlegendLayer.title = "Location: This is the location";

var template = new PrintTemplate({
format: "pdf",
exportOptions: {
dpi: 300
layout: "tabloid-ansi-b-landscape",
layoutOptions: {
titleText: "Test Map",
authorText: "Ben Loewe",
copyrightText: "My Company",
scalebarUnit: "Miles",
legendLayers: [colorlegendLayer, locationlegendLayer]
preserveScale: true

var params = new PrintParameters({
view: view,
template: template

printTask.execute(params).then(printResult, promiseRejected);