javascriptarcgisesriarcgis-js-api

What is the difference between esri print task and export web map


While taking screenshot of the current map using arcgis JavaScript, I could see that we have two ways to take the screenshots.
I could see same question asked here

  1. using /export of url
    enter image description here

  2. using print task api

        var printTask = new esriLoader.PrintTask(PrintTaskServiceUrl);
        esriLoader.Config.defaults.io.proxyUrl = proxyUrl;
        esriLoader.Config.defaults.io.alwaysUseProxy = true;
        var template = new esriLoader.PrintTemplate();
        template.exportOptions = {
            width: 1015,
            height: 633,
            dpi: 96 // if 200 ,map image will get good quality
        };
        template.format = "JPG";
        template.layout = "MAP_ONLY",
        template.preserveScale = false;
        template.showLabels = true;
        template.showAttribution = false;
    
        template.layoutOptions = {
            "legendLayers": [], // empty array means no legend
            "scalebarUnit": "Miles",
            "copyrightText": "<div>xxx</div>",
        }
        var params = new esriLoader.PrintParameters();
    
        params.map = map;
        params.template = template;
    
        printTask.execute(params, success, error);
    

So, what is the difference between these 2 methods?


Solution

    1. Is the REST API provided by ArcGIS Server to generated map images.
    2. Is the Javascript object with in ArcGIS JavaScript SDK.

    The PrintTask will use the Export Web Map Task from REST api to generate the map image. PrintTask provides a simple way of creating images. On the other hand, if you want to use the REST API directly you can do so, by using esri\request object, but you would have to generate all the required parameters as described by the API.