<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Map prints on double click? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-prints-on-double-click/m-p/275853#M25449</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So, I'm printing a map on the click of a button. I am zooming at a certain point but the map is showing on the second click on the print button. This is my code where I am querying the map, zooming, printing the image, etc.&lt;/P&gt;&lt;P&gt;What could be the issue for the map?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function printMap() {&lt;BR /&gt;require(["dojo/on", "esri/config", "esri/tasks/QueryTask", "esri/tasks/query", 'esri/symbols/SimpleMarkerSymbol', "esri/symbols/SimpleLineSymbol", "esri/Color", 'esri/geometry/Extent', "esri/tasks/PrintTask", "esri/tasks/PrintParameters", "esri/tasks/PrintTemplate", "dojo/domReady!"],&lt;BR /&gt;function (on, esriConfig, QueryTask, Query, SimpleMarkerSymbol, SimpleLineSymbol, Color, Extent, PrintTask, PrintParameters, PrintTemplate) {&lt;BR /&gt;console.log("globalParcel :: " + globalParcel + " reportType :: " + reportType + " globalScale :: " + sentScale);&lt;/P&gt;&lt;P&gt;var queryTask = new QueryTask("https://service.com");&lt;BR /&gt;var query = new Query();&lt;BR /&gt;query.where = "code ='" + globalParcel + "'";&lt;BR /&gt;query.outSpatialReference = map.spatialReference;&lt;BR /&gt;query.returnGeometry = true;&lt;BR /&gt;query.outFields = ["*"];&lt;BR /&gt;queryTask.execute(query, zoomToRoute);&lt;/P&gt;&lt;P&gt;// ZOOM TO ROUTE&lt;BR /&gt;function zoomToRoute(features) {&lt;/P&gt;&lt;P&gt;var num = features.features.length;&lt;BR /&gt;var map = this.map;&lt;BR /&gt;map.graphics.clear();&lt;/P&gt;&lt;P&gt;var pointSymbolNew = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 255, 255]), 1), new Color([255, 0, 127, 1]));&lt;BR /&gt;var selectedFeature = features.features;&lt;BR /&gt;selectedFeature[0].setSymbol(pointSymbolNew);&lt;BR /&gt;map.graphics.add(selectedFeature[0]);&lt;BR /&gt;var lat = selectedFeature[0].geometry.x; //getLatitude();&lt;BR /&gt;var longs = selectedFeature[0].geometry.y; //getLongitude();&lt;/P&gt;&lt;P&gt;var point = new esri.geometry.Point({&lt;BR /&gt;latitude: lat,&lt;BR /&gt;longitude: longs&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;map.centerAt(point);&lt;/P&gt;&lt;P&gt;var factor = 3; //some factor for converting point to extent --&amp;gt;&lt;BR /&gt;var extent = new Extent(lat - factor, longs - factor, lat + factor, longs + factor, map.spatialReference);&lt;/P&gt;&lt;P&gt;map.setExtent(extent);&lt;BR /&gt;map.setScale(sentScale);&lt;BR /&gt;setTimeout(printImage, 1000);&lt;BR /&gt;}&lt;BR /&gt;// ZOOM TO ROUTE&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// SET COOKIE&lt;BR /&gt;function setCookie(cname, cvalue, exdays) {&lt;BR /&gt;var d = new Date();&lt;BR /&gt;d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));&lt;BR /&gt;var expires = "expires=" + d.toGMTString();&lt;BR /&gt;document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";&lt;BR /&gt;}&lt;BR /&gt;// SET COOKIE&lt;/P&gt;&lt;P&gt;// PRINT IMAGE&lt;BR /&gt;function printImage() {&lt;/P&gt;&lt;P&gt;var printTask;&lt;BR /&gt;var params = new PrintParameters();&lt;/P&gt;&lt;P&gt;if (sentScale == 1000) {&lt;/P&gt;&lt;P&gt;printTask = new PrintTask('https://&lt;SPAN&gt;service.com&lt;/SPAN&gt;/GPServer/Export%20Web%20Map');&lt;BR /&gt;params.map = map;&lt;BR /&gt;}&lt;BR /&gt;else if (sentScale == 2500) {&lt;/P&gt;&lt;P&gt;printTask = new PrintTask('https://&lt;SPAN&gt;service.com&lt;/SPAN&gt;/GPServer/Export%20Web%20Map');&lt;BR /&gt;params.map = map;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var template = new PrintTemplate();&lt;BR /&gt;template.format = 'JPG';&lt;BR /&gt;template.layout = 'MAP_ONLY';&lt;BR /&gt;template.preserveScale = false;&lt;BR /&gt;params.template = template;&lt;/P&gt;&lt;P&gt;printTask.execute(params, printResult);&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;// PRINT IMAGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// PRINT RESULT&lt;BR /&gt;function printResult(evt) {&lt;/P&gt;&lt;P&gt;imageUrl = evt.url;&lt;BR /&gt;setCookie('imageUrl', imageUrl, 1);&lt;BR /&gt;console.log("imageUrl", imageUrl);&lt;/P&gt;&lt;P&gt;if (reportType == 1) {&lt;BR /&gt;printReport();&lt;BR /&gt;}&lt;BR /&gt;if (reportType == 2) {&lt;/P&gt;&lt;P&gt;var printTaskLegend;&lt;BR /&gt;var printPars = new PrintParameters();&lt;BR /&gt;printPars.map = map;&lt;/P&gt;&lt;P&gt;if (sentScale == 1000) {&lt;BR /&gt;printTaskLegend = new PrintTask('https://&lt;SPAN&gt;service.com&lt;/SPAN&gt;/GPServer/Export%20Web%20Map');&lt;BR /&gt;printPars.map = map;&lt;BR /&gt;}&lt;BR /&gt;else if (sentScale == 2500) {&lt;/P&gt;&lt;P&gt;printTaskLegend = new PrintTask('https://&lt;SPAN&gt;service.com&lt;/SPAN&gt;/GPServer/Export%20Web%20Map');&lt;BR /&gt;printPars.map = map;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var template = new PrintTemplate();&lt;BR /&gt;template.format = 'JPG';&lt;BR /&gt;template.layout = 'Print_legend_included';&lt;BR /&gt;template.preserveScale = true;&lt;BR /&gt;printPars.template = template;&lt;BR /&gt;printTaskLegend.execute(printPars, printImageLegend);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;// PRINT RESULT&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// PRINT IMAGE LEGEND&lt;BR /&gt;function printImageLegend(evt) {&lt;/P&gt;&lt;P&gt;imageLegendUrl = evt.url;&lt;BR /&gt;setCookie('imageLegendUrl', imageLegendUrl, 1);&lt;BR /&gt;console.log("image legend url :: " + imageLegendUrl);&lt;BR /&gt;printReport();&lt;BR /&gt;}&lt;BR /&gt;// PRINT IMAGE LEGEND&lt;/P&gt;&lt;P&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Jun 2020 07:21:27 GMT</pubDate>
    <dc:creator>NovicaJosifovski</dc:creator>
    <dc:date>2020-06-25T07:21:27Z</dc:date>
    <item>
      <title>Map prints on double click?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-prints-on-double-click/m-p/275853#M25449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So, I'm printing a map on the click of a button. I am zooming at a certain point but the map is showing on the second click on the print button. This is my code where I am querying the map, zooming, printing the image, etc.&lt;/P&gt;&lt;P&gt;What could be the issue for the map?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function printMap() {&lt;BR /&gt;require(["dojo/on", "esri/config", "esri/tasks/QueryTask", "esri/tasks/query", 'esri/symbols/SimpleMarkerSymbol', "esri/symbols/SimpleLineSymbol", "esri/Color", 'esri/geometry/Extent', "esri/tasks/PrintTask", "esri/tasks/PrintParameters", "esri/tasks/PrintTemplate", "dojo/domReady!"],&lt;BR /&gt;function (on, esriConfig, QueryTask, Query, SimpleMarkerSymbol, SimpleLineSymbol, Color, Extent, PrintTask, PrintParameters, PrintTemplate) {&lt;BR /&gt;console.log("globalParcel :: " + globalParcel + " reportType :: " + reportType + " globalScale :: " + sentScale);&lt;/P&gt;&lt;P&gt;var queryTask = new QueryTask("https://service.com");&lt;BR /&gt;var query = new Query();&lt;BR /&gt;query.where = "code ='" + globalParcel + "'";&lt;BR /&gt;query.outSpatialReference = map.spatialReference;&lt;BR /&gt;query.returnGeometry = true;&lt;BR /&gt;query.outFields = ["*"];&lt;BR /&gt;queryTask.execute(query, zoomToRoute);&lt;/P&gt;&lt;P&gt;// ZOOM TO ROUTE&lt;BR /&gt;function zoomToRoute(features) {&lt;/P&gt;&lt;P&gt;var num = features.features.length;&lt;BR /&gt;var map = this.map;&lt;BR /&gt;map.graphics.clear();&lt;/P&gt;&lt;P&gt;var pointSymbolNew = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 255, 255]), 1), new Color([255, 0, 127, 1]));&lt;BR /&gt;var selectedFeature = features.features;&lt;BR /&gt;selectedFeature[0].setSymbol(pointSymbolNew);&lt;BR /&gt;map.graphics.add(selectedFeature[0]);&lt;BR /&gt;var lat = selectedFeature[0].geometry.x; //getLatitude();&lt;BR /&gt;var longs = selectedFeature[0].geometry.y; //getLongitude();&lt;/P&gt;&lt;P&gt;var point = new esri.geometry.Point({&lt;BR /&gt;latitude: lat,&lt;BR /&gt;longitude: longs&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;map.centerAt(point);&lt;/P&gt;&lt;P&gt;var factor = 3; //some factor for converting point to extent --&amp;gt;&lt;BR /&gt;var extent = new Extent(lat - factor, longs - factor, lat + factor, longs + factor, map.spatialReference);&lt;/P&gt;&lt;P&gt;map.setExtent(extent);&lt;BR /&gt;map.setScale(sentScale);&lt;BR /&gt;setTimeout(printImage, 1000);&lt;BR /&gt;}&lt;BR /&gt;// ZOOM TO ROUTE&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// SET COOKIE&lt;BR /&gt;function setCookie(cname, cvalue, exdays) {&lt;BR /&gt;var d = new Date();&lt;BR /&gt;d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));&lt;BR /&gt;var expires = "expires=" + d.toGMTString();&lt;BR /&gt;document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";&lt;BR /&gt;}&lt;BR /&gt;// SET COOKIE&lt;/P&gt;&lt;P&gt;// PRINT IMAGE&lt;BR /&gt;function printImage() {&lt;/P&gt;&lt;P&gt;var printTask;&lt;BR /&gt;var params = new PrintParameters();&lt;/P&gt;&lt;P&gt;if (sentScale == 1000) {&lt;/P&gt;&lt;P&gt;printTask = new PrintTask('https://&lt;SPAN&gt;service.com&lt;/SPAN&gt;/GPServer/Export%20Web%20Map');&lt;BR /&gt;params.map = map;&lt;BR /&gt;}&lt;BR /&gt;else if (sentScale == 2500) {&lt;/P&gt;&lt;P&gt;printTask = new PrintTask('https://&lt;SPAN&gt;service.com&lt;/SPAN&gt;/GPServer/Export%20Web%20Map');&lt;BR /&gt;params.map = map;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var template = new PrintTemplate();&lt;BR /&gt;template.format = 'JPG';&lt;BR /&gt;template.layout = 'MAP_ONLY';&lt;BR /&gt;template.preserveScale = false;&lt;BR /&gt;params.template = template;&lt;/P&gt;&lt;P&gt;printTask.execute(params, printResult);&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;// PRINT IMAGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// PRINT RESULT&lt;BR /&gt;function printResult(evt) {&lt;/P&gt;&lt;P&gt;imageUrl = evt.url;&lt;BR /&gt;setCookie('imageUrl', imageUrl, 1);&lt;BR /&gt;console.log("imageUrl", imageUrl);&lt;/P&gt;&lt;P&gt;if (reportType == 1) {&lt;BR /&gt;printReport();&lt;BR /&gt;}&lt;BR /&gt;if (reportType == 2) {&lt;/P&gt;&lt;P&gt;var printTaskLegend;&lt;BR /&gt;var printPars = new PrintParameters();&lt;BR /&gt;printPars.map = map;&lt;/P&gt;&lt;P&gt;if (sentScale == 1000) {&lt;BR /&gt;printTaskLegend = new PrintTask('https://&lt;SPAN&gt;service.com&lt;/SPAN&gt;/GPServer/Export%20Web%20Map');&lt;BR /&gt;printPars.map = map;&lt;BR /&gt;}&lt;BR /&gt;else if (sentScale == 2500) {&lt;/P&gt;&lt;P&gt;printTaskLegend = new PrintTask('https://&lt;SPAN&gt;service.com&lt;/SPAN&gt;/GPServer/Export%20Web%20Map');&lt;BR /&gt;printPars.map = map;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var template = new PrintTemplate();&lt;BR /&gt;template.format = 'JPG';&lt;BR /&gt;template.layout = 'Print_legend_included';&lt;BR /&gt;template.preserveScale = true;&lt;BR /&gt;printPars.template = template;&lt;BR /&gt;printTaskLegend.execute(printPars, printImageLegend);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;// PRINT RESULT&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// PRINT IMAGE LEGEND&lt;BR /&gt;function printImageLegend(evt) {&lt;/P&gt;&lt;P&gt;imageLegendUrl = evt.url;&lt;BR /&gt;setCookie('imageLegendUrl', imageLegendUrl, 1);&lt;BR /&gt;console.log("image legend url :: " + imageLegendUrl);&lt;BR /&gt;printReport();&lt;BR /&gt;}&lt;BR /&gt;// PRINT IMAGE LEGEND&lt;/P&gt;&lt;P&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2020 07:21:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-prints-on-double-click/m-p/275853#M25449</guid>
      <dc:creator>NovicaJosifovski</dc:creator>
      <dc:date>2020-06-25T07:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Map prints on double click?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-prints-on-double-click/m-p/275854#M25450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure this will solve the issue, but this line confuses me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="background-color: #ffffff; "&gt;printTask.execute(params, printResult);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I would recommend something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #595959; "&gt;printTask.execute(params).then(printResult, printError);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #595959; "&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-PrintTask.html#execute" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-PrintTask.html#execute"&gt;PrintTask.execute() doc&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #595959; "&gt;The second parameter in the print method is for requestOptions, not for the returned object.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2020 18:39:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-prints-on-double-click/m-p/275854#M25450</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2020-06-25T18:39:28Z</dc:date>
    </item>
  </channel>
</rss>

