AnsweredAssumed Answered

PrintTask Error first time executing task

Question asked by gopre400 on Jun 2, 2016
Latest reply on Jun 3, 2016 by bdaigle

I get an error the first time I execute a print task on a page. This is error I get..."RequestError: Unable to Load /proxy/...<print task url>/execute status: 404." Despite getting error the first time I execute task, it works flawlessly after that. Am I missing something?


Here is code...

$("#btnPrintDefault").on("click", function () {                    

printUrl = "";                    

var printTask = new PrintTask(printUrl);                    

var template = new PrintTemplate();                    

var legendLayer = new esri.tasks.LegendLayer();                    

legendLayer.layerId = "roadLayer";                    

legendLayer.subLayerIds = [58, 117];                                        

template.format = "PDF";                   

template.layout = "Letter ANSI A Landscape";                    

template.layoutOptions = {                        

"titleText": "Spokane County",                        

"scalebarUnit": "Miles",                        

"legendLayers": [legendLayer]                    


template.preserveScale = true;                    

var params = new PrintParameters();             = map;                    

params.template = template;                    

$('#mapPage').css("cursor", "progress");                    

printTask.execute(params, getPrinted, getPrintError);