3

I have an ASP.NET MVC application that displays a map using Esri's ArcGIS for JavaScript, 3.18. I want to print the map and all visible layers using a Export Web Map Task (PrintingTools Service) on our onsite ArcGIS for Server. I am using esri/tasks/PrintTask in JavaScript to call the execute function and return a URL to an image (or PDF) of the map.

When the only layers visible are Esri's streets basemap and my client-side rendered graphics layers (drawing/highlighting a route on the map), the execute function works. However, when I have layers visible that are dynamic map service layers or feature layers, the map will not print. These map services are on the same server as the PrintingTools Service. I've tried with and without using a proxy. The error message is as follows:

{"error":{"code":400,"message":"Unable to complete operation.","details":["Error executing tool. Export Web Map Task Job ID: asdfl;kjasdf;lj : Layer \"graphicsLayer3\": Failed to create layer from service at https://[ourserver]/arcgis/rest/services/[testservice]/MapServer/6 ...

Is it possible that the FeatureLayer or MapService has security that does not allow the PrintingTools Service access? Even when located on the same server?

This is the function in my dojo widget that I am using to test printing; nothing out of the ordinary:

testPrint: function () {
    var printParams = new PrintParameters();
    printParams.map = this.map;
    this._printTask = new PrintTask(appConfig.map.services.printTaskUrl, printParams);
    this._printTask.execute(printParams,
        function (success) {
            console.log("Print success" + JSON.stringify(success));
            window.open(success.url, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
        }, function (err) {
            console.log("Print failed" + err.details);
        });
}

closed as off-topic by PolyGeo Jun 4 '18 at 3:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • DId you ever find out about this? With the most recent AGOL update, it appears that the print task does not play well with feature services. – AndrewCLT Apr 26 '18 at 19:18
  • Nope. I dropped it for the time being. I ended up removing layers prior to printing, then performing print, then adding the layers back. Very hackish and I wasn't happy with that solution. I noticed that ArcGIS for JavaScript 3.24 includes updates to printing (developers.arcgis.com/javascript/3/jshelp/whats_new.html). – iCode May 3 '18 at 15:15
  • From the link above on improvements to printing in ArcGIS for JavaScript API version 3.24: "Printing has made some significant improvements at this release. The URL parser of the PrintTask is more robust to better handle custom printing services. We added the ability to print feature attributes in feature collection layers (even when they are not needed for rendering). We expanded support for printing CJKV characters. We also fixed an issue with printing layers that do not use default symbology, and instead printed "Override" in the legend..." – iCode May 3 '18 at 15:29
  • @PolyGeo, how on Earth is my question off topic??? How about some explanation? – iCode Jun 6 '18 at 18:46
  • Your two previous comments seemed to be saying that you had dropped researching your issue because you had hacked a workaround, and that you seemed to be thinking that 3.24 held a solution. In other words your circumstances seemed to have changed. If you are still stuck then just revise your question with your current status so that it may be progressed. – PolyGeo Jun 6 '18 at 20:14