Hi
Below is the code I am using it for Print the Map . The code works fine and got the output as PDF file in separate window.
But the issue is map extent in the application and map extent in PDF output are not matching exactly. "Image1" is from WAB application and "Image2" is from PDF out put . Kindly refer the attached Image for reference.
var url = "https://servername/gis/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.layoutOptions = {"legendLayers": [legendLayers],
"titleText": "Map Print",
"authorText": "AAAAAAAA",
"copyrightText": "BBBBBBBB",
"scalebarUnit": "Kilometers"};
params.map = this.map;
params.template = template;
printTask.on("error",lang.hitch(this, this._printResultError));
printTask.execute(params, lang.hitch(this, this._printResult));
_printResultError:function(err)
{
alert(err);
},
_printResult:function(res){
window.open(res.url, "_blank")
},