I have an application where i'm printing a map on one page and would like to display the result in a PDF when the user goes to the summary page. The print task takes about 4-5 seconds to return the URL. I don't want my user to sit on the page to wait for the print task to finish instead of moving to another page.
Is there a way to retrieve the Print task URL at a later point based on some ID?
Update: I changed by service to asynchronous and also set the async flag to 'true'.But when i run printtask.execute(printParameters) i'm not getting a jobID back. Here is the code snippet:
var initPrintParameters = function () {
var temp = new PrintTemplate();
temp.exportOptions = {
width: dpi * 10, //3000, //960, //840,
height: (20 * dpi) / 3, //640, //560,
dpi: dpi
};
temp.format = "PNG32";
temp.layout = "MAP_ONLY";
temp.preserveScale = true;
temp.showAttribution = true;
printParameters = new PrintParameters();
printParameters.format = "png32";
printParameters.template = temp;
printParameters.map = map;
printParameters.outSpatialReference = map.spatialReference;
printParameters.async=true;
};
var exportMapAtCurrentExtent=function(){
printTask=PrintTask(printTaskUrl);
initPrintParameters();
console.log(printTask.execute(printParameters));
};
Not sure if there is anything else that i need to do. Couldn't find any reference on how to execute printTask asynchronously .