I have an esri map, and a print task service , After loading the map , I have added custom graphics on my map , but when i tried to take the screenshot by using JavaScript Print Task (**esri.tasks.PrintTask**) , it is only printing the default map same as it is ArcGIS Server, not printing the programmatically added custom graphics. Here is my code.
this.exportWebMap=function(url,map,width,height){
var deferred = new Deferred();
var printTask = new PrintTask(url);
var attrs={};
var template = new PrintTemplate();
var mapWidth=map&&map.width?map.width:this.currentMap.width;
var mapHeight=map&&map.height?map.height:this.currentMap.height;
template.exportOptions = {
width: mapWidth,
height: mapHeight,
dpi: 96
};
template.format = "JPG";
template.layout = "MAP_ONLY",
template.preserveScale = false;
template.showLabels = true;
template.showAttribution = false;
template.layoutOptions = {
"legendLayers": [], // empty array means no legend
"scalebarUnit": "Miles",
"copyrightText": "<div>xxx</div>",
}
var params = new PrintParameters();
params.map = map||this.currentMap;
params.template = template;
printTask.execute(params, function(success){
deferred.resolve(success);
},
function(error){
deferred.resolve(error);
});
return deferred.promise;
}