Print Legend on a seperat Page

5316
11
Jump to solution
11-17-2015 03:12 AM
MiriamBrockmann
Occasional Contributor

Hi there!

My Question is simple : can you print the Legend, made by the LegendLayer of the PrintTask on a seperate Page?

I've searched the Web up and down, but don't get any hints for a solution.

I've setup my own Layout, but can only place an Legendfield on the same Page. Theres no option for a second.

Regards, Miriam

11 Replies
TracySchloss
Frequent Contributor

I would love to see your code, if you're willing to post it.  I don't need to print the legend separately, but I have had requests to print a map and a table as one report.

0 Kudos
MiriamBrockmann
Occasional Contributor

Okay..I tried to post the Code....never done this bevor, so don't blame if it's not displayed correctly 😉

If the table and the Map should be in one print you have to make your own Layout.

Therefore you need to setup an own Webmap Export Task.

How to do this is shown in the OnlineHelp - Tutorial: Publishing additional services for printing—Documentation (10.3 and 10.3.1) | ArcGIS for S...

We have programmed a FloatingPanel where the User can make all necessary settings for the Print like Size, Format, DPI, Scale, Orientation ( Portrait or Landscape ), print with Basemaps or without, with Legend or not or just the Map like its shown.

When the USer push the Print Button, this function does all the work and calls the Printer.

   function analyzePrintParameter(PrintScale,PrintOri,PrintDPI,PrintOutput){

  

        require(["dojo/_base/array",

             "dojo/dom",

             "dojo/dom-style",

             "dojo/on",

             "dijit/registry",

             "esri/geometry/Point",

             "esri/SpatialReference",

             "esri/tasks/PrintParameters",

             "esri/tasks/PrintTask",

             "esri/tasks/PrintTemplate"],

    function(       arrayUtils,

                         dom,

                         domStyle,

                         on,registry,

                         Point,SpatialReference,

                         PrintParameters,PrintTask,PrintTemplate){

                //Basemaps  on/off

                if(registry.byId("CBBaseMapEinAus").get("checked")){

                    //filter the first Childnodeof Basemaps

                         arrayUtils.forEach(map.layerIds, function(id){

                                 var layer = map.getLayer(id);

                              if (layer._basemapGalleryLayerType === "basemap") {

                                    layer.hide();

                        }

                        });

                    }

        var printTask = new esri.tasks.PrintTask(app.printUrl, {async : true});

          

            var template = new PrintTemplate();

          

            if(registry.byId("radioOriPortrait").checked){

                if (registry.byId("NurKarteId").checked) {

                    template.layout = "A" + PrintOri + " " + registry.byId("radioOriPortrait").value + " pur";

                }

                else {

                    template.layout = "A" + PrintOri + " " + registry.byId("radioOriPortrait").value;

                }

            }

          

            if(registry.byId("radioOriLandscape").checked){

                if (registry.byId("NurKarteId").checked) {

                    template.layout = "A" + PrintOri + " " + registry.byId("radioOriLandscape").value + " pur";

                }

                else {

                    template.layout = "A" + PrintOri + " " + registry.byId("radioOriLandscape").value;

                }

            }

                template.label = PrintOri;

                template.format = PrintOutput;

                template.preserveScale = true;

                template.outScale = PrintScale;

             app.template = template;

           

             printTask.execute(app, printResult);

  

            function printResult(result) {

                  window.open(result.url);

            }

            //Print Legend if Checkbox is marked

            if(registry.byId("LegendeEinAus").checked){

                PrintLegend(PrintScale,PrintOri,PrintDPI,PrintOutput);

            }

           // close FloatingPane

            closePrintPane();

    });

}  

Hope this answers your question. If not...feel free to ask.

Regards Miriam