Note that there are some explanatory texts on larger screens.

plurals
  1. POEsri ArcGIS Print the map
    text
    copied!<p>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 my problem is to implement the all three step(Print,Printing,PrintOut) in one click (Prefer some other click).</p> <p>for that purpose i did something like---</p> <p>first i added one div in design level and set visiblity as false</p> <pre><code> &lt;div id="print_button" style="visibility:hidden;display:none;"&gt;&lt;/div&gt; </code></pre> <p>In init i use esri.dijit.Print option </p> <pre><code> 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(); </code></pre> <p>and in my click internally i want to click this print button</p> <pre><code>function export1() { document.getElementById('print_button').click();//This is not working obviously this is not a button return false; } </code></pre> <p>How can i achive this. Please help me.</p> <hr> <p>After Anyalysis this div i found these elements </p> <pre><code>&lt;div class="esriPrint"&gt; &lt;span class="dijit dijitReset dijitInline dijitButton esriPrintButton dijitButtonDisabled dijitDisabled" role="presentation" widgetId="dijit_form_Button_0"&gt; &lt;span class="dijitReset dijitInline dijitButtonNode" role="presentation" data-dojo-attach-event="ondijitclick:_onClick"&gt; &lt;span disabled="" class="dijitReset dijitStretch dijitButtonContents" id="dijit_form_Button_0" role="button" aria-disabled="true" aria-labelledby="dijit_form_Button_0_label" style="-ms-user-select: none;" data-dojo-attach-point="titleNode,focusNode"&gt; &lt;span class="dijitReset dijitInline dijitIcon dijitNoIcon" data-dojo-attach-point="iconNode"&gt; &lt;/span&gt; &lt;span class="dijitReset dijitToggleButtonIconChar"&gt; ● &lt;/span&gt; &lt;span class="dijitReset dijitInline dijitButtonText" id="dijit_form_Button_0_label" data-dojo-attach-point="containerNode"&gt; Printing &lt;/span&gt; &lt;/span&gt; &lt;/span&gt; &lt;input tabindex="-1" disabled="" class="dijitOffScreen" role="presentation" type="button" value="" data-dojo-attach-point="valueNode"&gt; &lt;/span&gt;&lt;/div&gt; &lt;div class="esriPrint"&gt; &lt;span class="dijit dijitReset dijitInline dijitButton esriPrintButton" role="presentation" widgetId="dijit_form_Button_1"&gt; &lt;span class="dijitReset dijitInline dijitButtonNode" role="presentation" data-dojo-attach-event="ondijitclick:_onClick"&gt; &lt;span tabindex="0" class="dijitReset dijitStretch dijitButtonContents" id="dijit_form_Button_1" role="button" aria-labelledby="dijit_form_Button_1_label" style="-ms-user-select: none;" data-dojo-attach-point="titleNode,focusNode"&gt; &lt;span class="dijitReset dijitInline dijitIcon dijitNoIcon" data-dojo-attach-point="iconNode"&gt; &lt;/span&gt; &lt;span class="dijitReset dijitToggleButtonIconChar"&gt; ● &lt;/span&gt; &lt;span class="dijitReset dijitInline dijitButtonText" id="dijit_form_Button_1_label" data-dojo-attach-point="containerNode"&gt; Print &lt;/span&gt; &lt;/span&gt; &lt;/span&gt; &lt;input tabindex="-1" class="dijitOffScreen" role="presentation" type="button" value="" data-dojo-attach-point="valueNode"&gt; &lt;/span&gt;&lt;/div&gt; </code></pre> <p>but how can i call this click event because it simple to find the element but it is not simple to call click event or i dont know how to call data-dojo-attach-event="ondijitclick:_onClick" this event ?</p> <p>Can u suggest me how to call this event ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload