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;

  var exportMapAtCurrentExtent=function(){

Not sure if there is anything else that i need to do. Couldn't find any reference on how to execute printTask asynchronously .

1 Answer 1


If the ExportWebMap service is set to 'esriExecutionTypeAsynchronous', then yes, this is exactly how it works. You send a request and get a jobID back. It becomes the application's responsibility to query the task using the jobID, asking "are you done"? (when done, get the result.

If the service is Synchronous, then you'd have to push the request/response into something like a thread and allow the whole interaction to play out. The thread or worker process could return the result to the end user when done.

You have JavaScript API tagged, but talking about Java. I'll just assume you mean JavaScript and are working in HTML/JS pages. Check out: https://developers.arcgis.com/javascript/3/jsapi/printtask-amd.html - you'll see a boolean flag async that allows the task to work against both execution modes. So because it sounds like you want async, make sure your service is async and set this flag to true.

  • I have the ExportWebMap service set to 'Synchronous'. I'm currently doing the print task in JavaScript but i talk about Java because i would like to know if there is a way to call ExportWebMap service in the backend that way i dont really care which page the user is in.
    – Ravi
    Jul 26, 2018 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.