I am trying to use ArcGIS print services to print maps as pdf by using the Url from the ArcGIS server. I want to print the map and all visible layers using an Export Web Map Task (PrintingTools Service) from ArcGIS Server. I am passing my data as JSON string to execute URL and in return will get the URL of the PDF for downloading. here is my code
var spec = {
"Web_Map_as_JSON": JSON.stringify(web_map_json),
"Format": this.selectedFormat,
"Layout_Template": this.selectedLayout,
"f": "pjson"
};
var uri_spec = $.param(spec);
var url = this.map_service.printExecute_url;
var http = this.$http_({
method: "POST",
url: url,
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: uri_spec
});
http.success(function (data) {
console.log(data);
this.printState = false
};
The problem is that I keep getting this below error :
error:
code: 400
details: ['Error executing tool. Export Web Map Task : error …eb Map).\nFailed to execute (Export Web Map Task).']
extendedCode: -2147467261
message: "Unable to complete operation."
I have also referred to this similar questions https://gis.stackexchange.com/questions/119292/unable-to-print-feature-layer-from-my-arcgis-server but the solution doesn't work for me. Please let me know if there is any solution to this issue. Thanks in advance.