Print Template Set Legend Columns Via Javascript API

1798
0
05-12-2016 07:48 PM
bijupanicker
New Contributor III

Hi All,

I have a web application that displays map, based on dynamic layers, and provides basic functionality like zoom\pan, print(pdf export option) etc. Application uses javascript api. Now there is a requirement to show legend in the printed map pdf and also to add custom text and custom image\picture . So i added empty legend, text and picture elements in the templates of A3 , A4 mxds and published them as service. The templates have no data assigned so empty legend.

1.Am able to dynamically assign text values via the following lines of code for template

var legendLayer = new esri.tasks.LegendLayer();

legendLayer.layerId = "corridor"; // mapservice id

  legendLayer.subLayerIds = [0, 1,2,4,5,6,7,8,9,10];

var tmplate = new PrintTemplate();

tmplate .layout = plate.label = ch;\\template

tmplate .format = "PDF";

tmplate .layoutOptions = {    legendLayers: [legendLayer],      titleText: "test",     scalebarUnit: "Miles",

     authorText: "author,     copyrightText: "Copyright © 2016 Flex Pvt Ltd.",

     customTextElements: [  { Remarks: "test remarks" },   { text1: "xyz 123 " } ,    { text2: "abc 456" }   ]  };

2.Am not able to assign legend column numbers from code. For example setting no. of columns in legend to 3 or 4 etc or showing legend in horizontal instead of vertical etc. Is this possible to achieve this via code\api? If yes then how?

3.Am not able to assign Path(UNC etc) for the picture element from the code. I need this as in my case multiple images will be on a folder on server and user wants to select one of them to be shown on the printed page when using print option. So need to set the path dynamically. Is this possible to achieve this via code\api? If yes then how?

Thanks in advance for the help\guidance provided

regards

Biju

0 Kudos
0 Replies