Problems using Print

2385
4
Jump to solution
02-04-2016 02:56 PM
JohnPreston
Occasional Contributor

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%2...";            

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');           

});

0 Kudos
1 Solution

Accepted Solutions
JohnPreston
Occasional Contributor

on Print API reference page it says "Note that this functionality requires an ArcGIS Server 10.1 instance." Does that mean no other instance will work? (like 10.3.1?)

View solution in original post

4 Replies
JohnPreston
Occasional Contributor

on Print API reference page it says "Note that this functionality requires an ArcGIS Server 10.1 instance." Does that mean no other instance will work? (like 10.3.1?)

YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi John, I think the current setting for sampleserver6 print task is only able to print the sample domain of the service rather than any domain service. You should either test with your own print service or just print any services in samplerserver6. Hope this can help.

JordanBaumgardner
Occasional Contributor III

I agree with Yue. The problem is most likely on the report service side. Can you hit your own print service?

0 Kudos
JohnPreston
Occasional Contributor

Thank you!

Yes I changed the printurl to point to print service on my sever and it worked.

0 Kudos