
1. It says "No Access-Control-Allow-Orgin" , my mapservice is not secured . I am using the web adaptor URL for print task . 
2. ArcGIS Server and application both are running same machine. 
3. I tried including this is code (esriConfig.request.corsEnabledServers.push("https://myserver");) in startup function of the widget , same error message I am getting. 
Below is code am using for printing 
_onBtnPrintClicked: function(){
 var legendLayer = new LegendLayer();
 legendLayer.layerId = "WidgetName";
 legendLayer.subLayerIds = [0];
 legendLayer.subLayerIds = [1];
 var url = "https://servername/arcgis/rest/services/ExportWebMap5/GPServer/Export%20Web%20Map";
 var printTask = new PrintTask(url);
 var params = new PrintParameters();
 var template = new PrintTemplate();
 template.format = "PDF";
 template.layout = "Layout";
 template.layoutOptions = {//"legendLayers": [legendLayer], // empty array means no legend
 "titleText": "Map Print",
 "authorText": "xxxxxx",
 "copyrightText": "yyyyy",
 "scalebarUnit": "Kilometers",
 "customTextElements": [{"titleID": "Map Reports"}, {"genderID": "All"}]
 };
 template.preserveScale = false;
 debugger; 
 template.exportOptions = {
 width:500,
 height:600,
 dpi:96
 };
 params.map = this.map;
 params.template = template;
 printTask.on("error",lang.hitch(this, this._printResultError));
 printTask.execute(params, lang.hitch(this, this._printResult));
 },