Select to view content in your preferred language

JS API: Printing Legend with map

5329
2
11-10-2014 08:11 AM
JamesSampica
Deactivated User

On the Print Webmap sample (Print webmap | ArcGIS API for JavaScript ) there is this code and comment...

 

legendLayers: [], // empty array means no legend

 

What is supposed to be passed into here? The legend dijit has layers and layerInfos. I have tried both but I am not seeing any legend or symbology on the output.

 

0 Kudos
2 Replies
ChrisSergent
Deactivated User

According to this page, you want to use the layerId for the layers you want to add: PrintTemplate | API Reference | ArcGIS API for JavaScript

0 Kudos
JarrodDoucette
Emerging Contributor

Hi James,

I think you need to pass it a LegendLayer (notice no "s" on the end) object. 

This is probably the best discussion of how it works that I've been able to find.

No legend showing at all in ArcGIS Server print task (MapExport) - Geographic Information Systems St...

Also, note that if you delete that line you'll get a legend in your printed map. 

Jarrod