AnsweredAssumed Answered

Print Task Legend

Question asked by vikrant327 on Jul 3, 2012
Latest reply on Jul 5, 2012 by vikrant327
I have a secured map service and I tried to print the map with legend . Everything works except legend is not showing up in the print layer. Below is the code as how I am setting up the print button. Its same as given in one of the sample.

var layouts = [
          {
            "name": "Letter ANSI A Landscape",
            "label": "Landscape (PDF)",
            "format": "pdf",
            "options": {
              "legendLayers": [0,1,2,3], // empty array means no legend
              "scaleBarUnit": "Miles",
              "titleText":$("#title").val()
            }
          }, {
            "name": "Letter ANSI A Portrait",
            "label": "Portrait (Image)",
            "format": "pdf",
            "options":  {
              "legendLayers": [0,1,2,3],
              "scaleBarUnit": "Miles",
              "titleText": $("#title").val()
            }
          }
        ];
       
        // create the print templates, could also use dojo.map
        var templates = [];
        dojo.forEach(layouts, function(lo) {
          var t = new esri.tasks.PrintTemplate();
          t.layout = lo.name;
          t.label = lo.label;
          t.format = lo.format;
          t.layoutOptions = lo.options
          templates.push(t);
        });
      
        app.printer = new esri.dijit.Print({
          map: app.map,
    "templates": templates,
          url: "http://107.21.20.43/webgis/rest/services/GPServices/SecurePrinting/GPServer/Export%20Web%20Map?token=" + response
        }, dojo.byId("print_Button"));
        app.printer.startup();

Outcomes