Select to view content in your preferred language

Esri print task , missing custom graphics on export webmap

565
0
07-03-2017 05:39 AM
AhammadAli2
Deactivated User

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;
}

Tags (2)
0 Kudos
0 Replies