Issues in printing with legend with Javascript API 3.29

491
0
07-31-2019 11:51 PM
SrinivasOruganti
New Contributor II

Iam trying to use the Print API of ArcGIS Javascript API 3.29 to print the map with the legend.

Iam having issues in the output that is generated.

My actual layers have legends like 

But in the output print I get the following incorrect legend

I cannot see the names of the layers like Layer1 and Layer2.

Is this a bug or am I missing anything.

We are currently using the ArcGIS 10.4.

Following is the snippet of the code Iam trying to use.

var legendLayer = new LegendLayer();
legendLayer.layerId = fireLayer.id;
legendLayer.subLayerIds = [189,188,187];
var legendLayer1 = new LegendLayer();
legendLayer1.layerId = taturaLayer.id;
legendLayer1.subLayerIds = [3,7];
// create a print template for each choice
templates = arrayUtils.map(templateNames, function(ch) {
var plate = new PrintTemplate();
plate.layout = plate.label = ch;
plate.format = "PDF";
plate.layoutOptions = {
"authorText": "Made by: Esri's JS API Team",
"copyrightText": "<copyright info here>",
"legendLayers": [legendLayer,legendLayer1],
"titleText": "Test legend",
"scalebarUnit": "meters"
};
return plate;
});

// create the print dijit
app.printer = new Print({
"map": app.map,
"templates": templates,
url: app.printUrl
}, dom.byId("print_button"));
app.printer.startup();
}

 

Did any one have similar problem and was it resolved?

Also Observed that when we add polygon layer with no fill as a FeatureLayer and take the print, then in the legend sometime we get the title like graphicsLayer2 and in some cases we get the layer name in the legend but no graphic is displayed.

If we add the layer as ArcGISDynamicMapServiceLayer and take the print , then the legend comes fine.

Can some one let me know where the issue is?

Tags (1)
0 Kudos
0 Replies