AnsweredAssumed Answered

PrintTask not working in Web App Builder

Question asked by esrimohan on Dec 6, 2017
Latest reply on Dec 7, 2017 by esrimohan

Hi ,

 

Below is the code I am using it for PrintTask

 

var url = "https://servername:6443/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
var printTask = new PrintTask(url);
var params = new PrintParameters();
var template = new PrintTemplate();
template.format = "PDF";
template.layout = "MAP_ONLY";
template.preserveScale = false;
template.layoutOptions = {"legendLayers": [], 
"titleText": "Map Print",
"authorText": "AAAAA",
"copyrightText": "BBBBB",
"scalebarUnit": "Kilometers"};
params.map = this.map;
params.template = template;
printTask.execute(params, lang.hitch(this, this._printResult),lang.hitch(this, this._printResultError));

 

_printResultError:function(err)
{
debugger;
alert(err);
},
_printResult:function(res){
debugger;
window.open(res.url, "_blank")
},

 

I am getting the following error 

 

"Error executing tool. Export Web Map Task : Layer "ServiceName": Unable to connect to map server at https://servername:6443/arcgis/rest/services/ServiceName/MapServer.
Failed to execute (Export Web Map).
Failed to execute (Export Web Map Task)."

Outcomes