Select to view content in your preferred language

Print a map in ArcGIS JavaScript 3.5

747
0
06-19-2013 08:34 PM
RahulGupta1
Emerging Contributor
I am using ArcGIS javaScript 3.5 and i want to implement the print map.I know it is a in-built tool we can use that service also but i want to customized this tool and  my problem is to implement the all three step(Print,Printing,PrintOut) in one click (Prefer some other click).
for that purpose i did something like---
first i added one div in design level and set visiblity as false
 <div id="print_button" style="visibility:hidden;display:none;"></div>
In init i use esri.dijit.Print option

   var app = {};
        app.webmapId = "8315cf7d20f0484e869c4791f70f4f15";
        app.printUrl = "abc/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";

        var layouts = [{
            "name": "Letter ANSI A Landscape",
            "label": "Landscape (PDF)",
            "format": "pdf",
            "options": {
                "legendLayers": [], // empty array means no legend
                "scalebarUnit": "Miles",
                "titleText": "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": map,
            "templates": templates,
            url: app.printUrl,
        }, dojo.byId("print_button"));
        app.printer.startup();



and in my click internally i want to click this print button

function export() { 
document.getElementById('print_button').click();//This will not work obviously this is not a button 
return false;
}


HOw can i find the element and click event. i tried to quickwatch this element("print_button") but i didn't get any success
0 Kudos
0 Replies