AnsweredAssumed Answered

Problems using Print

Question asked by gopre400 on Feb 4, 2016
Latest reply on Feb 4, 2016 by gopre400

Hi, I'm trying to print a map using "esri/dijit/Print" I am adding a DynamicServiceLayer to a base map. When I click on the print button it flashes then nothing happens. I added a few handlers. print-start fires, print-complete does NOT fire, error does NOT fire. So the print starts but does not complete or does not throw an error.

 

I did try adding the layer as a FeatureLayer: I was able to print the base however the added feature layer did not print despite it being visible.

Map Service is located on ArcGIS Server 10.3.1 What am I missing?

 

here is how I add dynamic layer:

app.map = new Map("map", {                

basemap: "streets",                

center: [-117.42330, 47.751103],               

zoom: 18           

});            

var roadLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://igis.spokanecounty.org/arcgis/rest/services/Engineering/ENGINEERINGqueries/MapServer", {                

id: "roadLayer",                

visible: true            

});            

app.map.addLayers([roadLayer]);           

roadLayer.on("load", function () {             });            

roadLayer.setVisibleLayers([68]);

 

Here is print Dijit

app.printUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";            

app.printer = new Print({                

"map": app.map,                

"templates": [{                    

label: "Map",                   

format: "PDF",                   

layout: "MAP_ONLY",                   

exportOptions: {                        

width: 500,                        

height: 400,                       

dpi: 96                    

}                

},

{                    

label: "Layout",                    

format: "PDF",                    

layout: "A4 Portrait",                   

layoutOptions: {                        

titleText: "My Print",                        

authorText: "esri",                        

copyrightText: "My Company",                        

scalebarUnit: "Miles",                   

}                

}],                

url: app.printUrl           

},

dom.byId("print_button"));            

app.printer.startup();                        

 

app.printer.on('error', function (evt) {                

alert('The url to the print image is : ' + evt.result.url);           

});                        

 

app.printer.on('print-complete', function (evt) {                

alert('The url to the print image is : ' + evt.result.url);            

});            

 

app.printer.on('print-start', function (evt) {                

alert('started');           

});

Outcomes