<?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 Re: Dynamically update custom text element for print template layout in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690714#M64281</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is interesting, but the plate variable is used when creating the printer. With your solution, how could I get the print widget&amp;nbsp;this take into consideration the updates to the plate variable? The way I have it set up now, I think&amp;nbsp;that even updating the plate variable with every extent change, the printer would have the values that plate had when the widget was declared.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Nov 2016 01:52:50 GMT</pubDate>
    <dc:creator>Quynh_NhuMai</dc:creator>
    <dc:date>2016-11-30T01:52:50Z</dc:date>
    <item>
      <title>Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690711#M64278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on setting custom text elements via the template layout options for a print task to be used in a print widget. I am trying to get the custom text to display the lat long coordinates of the current map extent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I followed&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jssamples/widget_print_esri_request.html" rel="nofollow noopener noreferrer" target="_blank"&gt;this&lt;/A&gt;&amp;nbsp;sample to get the widget up and going. However, it sets up the template layouts and starts up the print widget when the app is loaded. This means that my "current" map extent for the layout is the initial map extent. Any suggestions on how to get the template custom text element to update to the current map extent? For the moment, I'm thinking that I have to set up and start up the print widget every time the extent changes...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have so far:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;require([
 "esri/layers/FeatureLayer",
 "esri/dijit/Print",
 "esri/tasks/PrintTemplate",
 "esri/request",
 "esri/config",
 "dojo/_base/array",
 "dojo/dom",
], function(
 FeatureLayer,
 Print, PrintTemplate,
 esriRequest, esriConfig,
 arrayUtils, dom
) {

//var printUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
 var printUrl = "http://ourserver/arcgis/rest/services/Our_Tools/Our_Print_Tool/GPServer/Exporter%20une%20carte%20Web";

esriConfig.defaults.io.proxyUrl = "http://ourserver/Java/proxy.jsp";

dojo.connect(window.myMap, "onExtentChange", showExtent);

// get print templates from the export web map task
 var printInfo = esriRequest({
 "url": printUrl,
 "content": {
 "f": "json"
 }
 });
 printInfo.then(handlePrintInfo, handleError);

 var center = "";
 var latLong = "";

function handlePrintInfo(resp) {
 var layoutTemplate, templateNames, mapOnlyIndex, templates;

 showExtent(window.myMap.extent)

 layoutTemplate = arrayUtils.filter(resp.parameters, function(param, idx) {
&amp;nbsp; return param.name === "Layout_Template";
 });

if ( layoutTemplate.length === 0 ) {
 console.log("print service parameters name for templates must be \"Layout_Template\"");
 return;
 }
 templateNames = layoutTemplate[0].choiceList;

// remove the MAP_ONLY template then add it to the end of the list of templates
 mapOnlyIndex = arrayUtils.indexOf(templateNames, "MAP_ONLY");
 if ( mapOnlyIndex &amp;gt; -1 ) {
 var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0];
 templateNames.push(mapOnly);
 }

// create a print template for each choice
 templates = arrayUtils.map(templateNames, function(ch) {
 var plate = new PrintTemplate();
 plate.layout = plate.label = ch;
 plate.format = "PDF";
 plate.layoutOptions = {
 customTextElements : [
 {
 centerLatLong: latLong,
 centerXY: center
 }
 ]
 };
 return plate;
 });

// create the print dijit
 printer = new Print({
 "map": window.myMap,
 "templates": templates,
 url: printUrl
 }, dom.byId("print_button"));
 printer.startup();
 }

function showExtent(extent) {
 var lat = window.myMap.extent.getCenter().getLatitude().toFixed(2);
 var long = window.myMap.extent.getCenter().getLongitude().toFixed(2);

 latLong = "Latitude : " + lat + " - Longitude : " + long;

 var X = window.myMap.extent.getCenter().x.toFixed(2);
 var Y = window.myMap.extent.getCenter().y.toFixed(2);

center = "X : " + X + " - Y : " + Y;

 console.log(latlong);
 console.log(center);
 }

function handleError(err) {
 console.log("Something broke: ", err);
 }
});










&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:48:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690711#M64278</guid>
      <dc:creator>NhuMai</dc:creator>
      <dc:date>2021-12-12T16:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690712#M64279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I would not setup or display the print widget until the user clicks a button in the app that says something like prepare to print or something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Nov 2016 02:29:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690712#M64279</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-11-26T02:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690713#M64280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could handle your print template "plate" as a global variable and on the map extent change event (&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jsapi/map-amd.html#event-extent-change" title="https://developers.arcgis.com/javascript/3/jsapi/map-amd.html#event-extent-change" rel="nofollow noopener noreferrer" target="_blank"&gt;Map | API Reference | ArcGIS API for JavaScript 3.18&lt;/A&gt;&amp;nbsp;) set the properties for the dynamic text&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;on&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'extent-change'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp; plate&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layoutOptions&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;customTextElements&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;centerLatLong &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; latLong&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp; plate&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layoutOptions&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;customTextElements&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;centerXY &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; center&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:04:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690713#M64280</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2021-12-12T05:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690714#M64281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is interesting, but the plate variable is used when creating the printer. With your solution, how could I get the print widget&amp;nbsp;this take into consideration the updates to the plate variable? The way I have it set up now, I think&amp;nbsp;that even updating the plate variable with every extent change, the printer would have the values that plate had when the widget was declared.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 01:52:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690714#M64281</guid>
      <dc:creator>Quynh_NhuMai</dc:creator>
      <dc:date>2016-11-30T01:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690715#M64282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;I considered this option, but there is&amp;nbsp;the possibility that users will pan or zoom right before making their template selection. The print widget template selection is only accessible after the printer is created (or so i believe...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make sure the extent printed to the map is correct,&amp;nbsp;I think I would have to prevent users from zooming or panning, which isn't preferable. Do you see any way around this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 01:57:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690715#M64282</guid>
      <dc:creator>Quynh_NhuMai</dc:creator>
      <dc:date>2016-11-30T01:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690716#M64283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would re-build the print widget on each extent change then if the print has already been opened.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 02:06:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690716#M64283</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-11-30T02:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690717#M64284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're right&amp;nbsp;- you just need to define the "plate" variable outside of the current function scope, so jou could define it at the start of the main require function (var plate;) and remove the variable declaration within the handlePrintInfo function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 06:03:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690717#M64284</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2016-11-30T06:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690718#M64285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see what you mean about making "var plate" global. It is true that when doing so, "plate" is correctly updated with each extent change. However, it doesn't update "printer" which uses plate, as the widget is initialized on page load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am still not seeing how just making plate global will update the layouts in the print widget with extent changes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2016 01:09:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690718#M64285</guid>
      <dc:creator>Quynh_NhuMai</dc:creator>
      <dc:date>2016-12-01T01:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690719#M64286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's because the "plate" template has not been redefined in the list of templates for the "printer". &amp;nbsp;So after each extent change, you also need to redefine the printer templates. &amp;nbsp;You can define "printer" also as a global variable first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;map&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444; border: 0px; font-weight: inherit;"&gt;on&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'extent-change'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;{&lt;/SPAN&gt;
&amp;nbsp; plate&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;layoutOptions&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;customTextElements&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;centerLatLong &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.498039); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; latLong&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;&lt;/SPAN&gt;
&amp;nbsp; plate&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;layoutOptions&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;customTextElements&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;centerXY &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.498039); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; center&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;
&lt;/SPAN&gt;&amp;nbsp; printer.templates = [plate];
&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:04:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690719#M64286</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2021-12-12T05:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690720#M64287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I&amp;nbsp;believe this is taking me closer to where I need. With the code below, though, I'm having issues debugging the following errors that occurs on&amp;nbsp;map extent change :&lt;/P&gt;&lt;P&gt;-exception in animation handler for: onEnd&lt;/P&gt;&lt;P&gt;-TypeError: Cannot read property 'call' of undefined(...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;connected the signal to update extents with map extent change within printInfoHandler, as I was having issues with parameters being defined within the latter. I don't know if this is the correct way to do so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;require([
 "esri/layers/FeatureLayer",
 "esri/dijit/Print",
 "esri/tasks/PrintTemplate",
 "esri/request",
 "esri/config",
 "dojo/_base/array",
 "dojo/dom",
], function(
 FeatureLayer,
 Print, PrintTemplate,
 esriRequest, esriConfig,
 arrayUtils, dom
) {

//var printUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; var printUrl = "http://ourserver/arcgis/rest/services/Our_Tools/Our_Print_Tool/GPServer/Exporter%20une%20carte%20Web";&lt;/PRE&gt;&lt;/PRE&gt;var center = "";&lt;BR /&gt; var latLong = "";&lt;BR /&gt; var printer;&lt;BR /&gt; var plate;&lt;BR /&gt;&lt;BR /&gt;esriConfig.defaults.io.proxyUrl = "http://ourserver/Java/proxy.jsp";&lt;BR /&gt;&lt;BR /&gt;// get print templates from the export web map task&lt;BR /&gt; var printInfo = esriRequest({&lt;BR /&gt; "url": printUrl,&lt;BR /&gt; "content": {&lt;BR /&gt; "f": "json"&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt; printInfo.then(handlePrintInfo, handleError);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; function handlePrintInfo(resp) {&lt;BR /&gt; var layoutTemplate, templateNames, mapOnlyIndex, templates;&lt;BR /&gt;&lt;BR /&gt;var lat = window.myMap.extent.getCenter().getLatitude().toFixed(2);&lt;BR /&gt; var long = window.myMap.extent.getCenter().getLongitude().toFixed(2);&lt;BR /&gt;&lt;BR /&gt;latLong = "Latitude : " + lat + " - Longitude : " + long;&lt;BR /&gt;&lt;BR /&gt;var X = window.myMap.extent.getCenter().x.toFixed(2);&lt;BR /&gt; var Y = window.myMap.extent.getCenter().y.toFixed(2);&lt;BR /&gt;&lt;BR /&gt;center = "X : " + X + " - Y : " + Y;&lt;BR /&gt;&lt;BR /&gt;console.log(latLong);&lt;BR /&gt; console.log(center);&lt;BR /&gt;&lt;BR /&gt;layoutTemplate = arrayUtils.filter(resp.parameters, function(param, idx) {&lt;BR /&gt; return param.name === "Layout_Template";&lt;BR /&gt; });&lt;BR /&gt;&lt;BR /&gt;if ( layoutTemplate.length === 0 ) {&lt;BR /&gt; console.log("print service parameters name for templates must be \"Layout_Template\"");&lt;BR /&gt; return;&lt;BR /&gt; }&lt;BR /&gt; templateNames = layoutTemplate[0].choiceList;&lt;BR /&gt;&lt;BR /&gt;// remove the MAP_ONLY template then add it to the end of the list of templates&lt;BR /&gt; mapOnlyIndex = arrayUtils.indexOf(templateNames, "MAP_ONLY");&lt;BR /&gt; if ( mapOnlyIndex &amp;gt; -1 ) {&lt;BR /&gt; var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0];&lt;BR /&gt; templateNames.push(mapOnly);&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;// create a print template for each choice&lt;BR /&gt; templates = arrayUtils.map(templateNames, function(ch) {&lt;BR /&gt; plate = new PrintTemplate();&lt;BR /&gt; plate.layout = plate.label = ch;&lt;BR /&gt; plate.format = "PDF";&lt;BR /&gt; plate.layoutOptions = {&lt;BR /&gt; customTextElements : [&lt;BR /&gt; {&lt;BR /&gt; centerLatLong: latLong,&lt;BR /&gt; centerXY: center&lt;BR /&gt; }&lt;BR /&gt; ]&lt;BR /&gt; };&lt;BR /&gt; return plate;&lt;BR /&gt; });&lt;BR /&gt;&lt;BR /&gt;// create the print dijit&lt;BR /&gt; printer = new Print({&lt;BR /&gt; "map": window.myMap,&lt;BR /&gt; "templates": templates,&lt;BR /&gt; url: printUrl&lt;BR /&gt; }, dom.byId("print_button"));&lt;BR /&gt; printer.startup();&lt;BR /&gt;&lt;BR /&gt;window.myMap.on('extent-change', showExtent());&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;function showExtent(extent) {&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; var lat = window.myMap.extent.getCenter().getLatitude().toFixed(2);&lt;BR /&gt; var long = window.myMap.extent.getCenter().getLongitude().toFixed(2);&lt;BR /&gt;&lt;BR /&gt;latLong = "Latitude : " + lat + " - Longitude : " + long;&lt;BR /&gt;&lt;BR /&gt;var X = window.myMap.extent.getCenter().x.toFixed(2);&lt;BR /&gt; var Y = window.myMap.extent.getCenter().y.toFixed(2);&lt;BR /&gt;&lt;BR /&gt;center = "X : " + X + " - Y : " + Y;&lt;BR /&gt;&lt;BR /&gt;plate.layoutOptions.customTextElements.centerLatLong = latLong;&lt;BR /&gt; plate.layoutOptions.customTextElements.centerXY = center;&lt;BR /&gt; printer.templates = [plate];&lt;BR /&gt;&lt;BR /&gt;console.log(latLong);&lt;BR /&gt; console.log(center);&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;function handleError(err) {&lt;BR /&gt; console.log("Something broke: ", err);&lt;BR /&gt; }&lt;BR /&gt;});&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:48:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690720#M64287</guid>
      <dc:creator>Quynh_NhuMai</dc:creator>
      <dc:date>2021-12-12T16:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690721#M64288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quynh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Change:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;window.myMap.on('extent-change', showExtent());

to:
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;window.myMap.on('extent-change', showExtent);&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:04:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690721#M64288</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T05:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690722#M64289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah whoops, okay--so that fixed the mentioned error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;printer now fails to reset the print layout list. No errors given, but the dropdown menu disappears and printing gives the map only output. I wonder if has to do with the way this line runs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="background-color: #ffffff; border: 0px;"&gt;printer.templates = [plate];&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Dec 2016 20:51:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690722#M64289</guid>
      <dc:creator>Quynh_NhuMai</dc:creator>
      <dc:date>2016-12-06T20:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update custom text element for print template layout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690723#M64290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quynh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; In your code the plate var is only going to be the last print template that you worked with in your&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;templates = arrayUtils.map(templateNames, function(ch) {
loop&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:48:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-update-custom-text-element-for-print/m-p/690723#M64290</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T16:48:32Z</dc:date>
    </item>
  </channel>
</rss>

