<?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: Potential Bug in Print Task? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423761#M38996</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am having a similar problem.&amp;nbsp; My map has a DynamicMapServiceLayer (id="dynamicLayer") with two group layers - LayerA (id=0) and LayerB (id=4).&amp;nbsp; LayerA has three subLayers (ids=1,2,3) and LayerB has three subLayers (ids=4,5,6).&amp;nbsp; In my map layerA and subLayers 1 and 3 are visible and everything else is not so dynamicLayer's visibleLayers attribute equals [0,1,3].&lt;BR /&gt;&lt;BR /&gt;Below is my pseudo code for printing the map:&lt;BR /&gt;&lt;BR /&gt;var legendLayer = new esri.tasks.LegendLayer();&lt;BR /&gt;legendLayer.layerId = "dynamicLayer";&lt;BR /&gt;legendLayer.subLayerIds = [0,1,3];&lt;BR /&gt;&lt;BR /&gt;var printTemplate = new esri.tasks.PrintTemplate();&lt;BR /&gt;printTemplate.format = "JPG";&lt;BR /&gt;printTemplate.layout = "Letter ANSI A Landscape";&lt;BR /&gt;var layoutOptions = {TitleText: "Test Map",&amp;nbsp;&amp;nbsp;&amp;nbsp; scalebarUnit: 'Miles', legendLayers: [legendLayer]};&lt;BR /&gt;printTemplate.layoutOptions = layoutOptions;&lt;BR /&gt;&lt;BR /&gt;var printParams = new esri.tasks.PrintParameters();&lt;BR /&gt;printParams.map = map;&lt;BR /&gt;printParams.outSpatialReference = map.spatialReference;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;printParams.template = printTemplate;&lt;BR /&gt;&lt;BR /&gt;var printURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task";&lt;BR /&gt;var printTask = new esri.tasks.PrintTask(printURL);&lt;BR /&gt;printTask.execute(printParams, function(result) {&lt;BR /&gt; window.open(result.url + "?timestamp="+(new Date().getTime()));&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;The problem is that the resulting map will include a legend with layers 1,2, and 3 in it even though they are not visible or in the legendLayer.subLayerIds.&amp;nbsp; If I change the legendLayer.subLayerIds to [1,3] nothing in the legend shows up.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was having this exact problem until I changed a setting in my template mxd. When i checked 'on' the "Only display layers that are checked on in the Table Of Contents" in the legend properties this issue seemed to go away.[ATTACH=CONFIG]19640[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Nov 2012 18:55:21 GMT</pubDate>
    <dc:creator>MichaelParry</dc:creator>
    <dc:date>2012-11-30T18:55:21Z</dc:date>
    <item>
      <title>Potential Bug in Print Task?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423755#M38990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Let's say you have a map service structured as follows and you want to display and print a map with only "Item 1" visible:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Item Name&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;ID&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;Folder 1 (0)&lt;/LI&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;Item 1 (1)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Item 2 (2)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;SPAN&gt;If you want just "Item 1" (ID = 1) to display, you &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;set the visible layers to [1]&lt;/SPAN&gt;&lt;SPAN&gt;.&amp;nbsp; Everything's perfect on the web map.&amp;nbsp; If you now try to print the map, "Item 1" will display on the printed map; however, &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;it will not display on the legend&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I thought maybe I needed to set "Folder 1" as visible in order to get "Item 1" to show up on the legend.&amp;nbsp; This time, I &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;set the visible items to [0, 1]&lt;/SPAN&gt;&lt;SPAN&gt;.&amp;nbsp; The printed map displays just like I wanted with "Item 1" in the map and legend and without "Item 2" displaying; however, &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;"Item 2" displays on the web map&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There appears to be an inconsistency between the JavaScript API and the PrintTask when it comes to handling this situation.&amp;nbsp; Is this a bug, or am I don't something wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--Alan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2012 13:30:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423755#M38990</guid>
      <dc:creator>AlanRussian</dc:creator>
      <dc:date>2012-07-17T13:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Potential Bug in Print Task?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423756#M38991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You only need to set the visibleLayer as [1]. When creating the print widget, assign the esri.tasks.PrintTemplate.layoutOptions.legend as an array of esri.tasks.LegendLayer objects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2012 23:10:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423756#M38991</guid>
      <dc:creator>JianHuang</dc:creator>
      <dc:date>2012-07-17T23:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Potential Bug in Print Task?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423757#M38992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jian,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was having the PrintTask do this.&amp;nbsp; Since I wasn't setting the legendLayers, this would happen automatically.&amp;nbsp; The &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/legendlayer.htm"&gt;documentation&lt;/A&gt;&lt;SPAN&gt; says, "If legendLayers is not specified, all operational layers will be present in the legend."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I was setting the visibleLayers on the layer to [1], and the PrintTask would set the visible layers in the legend to [1].&amp;nbsp; However, as I was saying in the OP, the visibleLayers parameter for the legend must include the parent layer in order for it to show up on the legend.&amp;nbsp; That is, I have to tell the legend that the visible layers are [0,1] in this example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've come up with code to generate a new list of visible layers that include the parent layer ids.&amp;nbsp; With help from your post, I then tell the PrintTask to use these IDs.&amp;nbsp; This solves the issue, but I still think this might be a bug with the legend.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 14:27:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423757#M38992</guid>
      <dc:creator>AlanRussian</dc:creator>
      <dc:date>2012-07-19T14:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Potential Bug in Print Task?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423758#M38993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree, will fix it soon. Thanks for letting me know this.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 17:45:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423758#M38993</guid>
      <dc:creator>JianHuang</dc:creator>
      <dc:date>2012-07-19T17:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Potential Bug in Print Task?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423759#M38994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am having a similar problem.&amp;nbsp; My map has a DynamicMapServiceLayer (id="dynamicLayer") with two group layers - LayerA (id=0) and LayerB (id=4).&amp;nbsp; LayerA has three subLayers (ids=1,2,3) and LayerB has three subLayers (ids=4,5,6).&amp;nbsp; In my map layerA and subLayers 1 and 3 are visible and everything else is not so dynamicLayer's visibleLayers attribute equals [0,1,3].&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is my pseudo code for printing the map:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var legendLayer = new esri.tasks.LegendLayer();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;legendLayer.layerId = "dynamicLayer";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;legendLayer.subLayerIds = [0,1,3];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var printTemplate = new esri.tasks.PrintTemplate();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printTemplate.format = "JPG";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printTemplate.layout = "Letter ANSI A Landscape";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var layoutOptions = {TitleText: "Test Map",&amp;nbsp;&amp;nbsp;&amp;nbsp; scalebarUnit: 'Miles', legendLayers: [legendLayer]};&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printTemplate.layoutOptions = layoutOptions;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var printParams = new esri.tasks.PrintParameters();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printParams.map = map;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printParams.outSpatialReference = map.spatialReference;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printParams.template = printTemplate;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;var printURL = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export" rel="nofollow" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export&lt;/A&gt;&lt;SPAN&gt; Web Map Task";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var printTask = new esri.tasks.PrintTask(printURL);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printTask.execute(printParams, function(result) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; window.open(result.url + "?timestamp="+(new Date().getTime()));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that the resulting map will include a legend with layers 1,2, and 3 in it even though they are not visible or in the legendLayer.subLayerIds.&amp;nbsp; If I change the legendLayer.subLayerIds to [1,3] nothing in the legend shows up.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2012 23:41:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423759#M38994</guid>
      <dc:creator>MichaelPorter1</dc:creator>
      <dc:date>2012-09-11T23:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Potential Bug in Print Task?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423760#M38995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Same here - before I try another route has anyone got any news about this bug?&amp;nbsp; Is it likely to be sorted in 3.3?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ACM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2012 13:03:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423760#M38995</guid>
      <dc:creator>AdrianMarsden</dc:creator>
      <dc:date>2012-11-21T13:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Potential Bug in Print Task?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423761#M38996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am having a similar problem.&amp;nbsp; My map has a DynamicMapServiceLayer (id="dynamicLayer") with two group layers - LayerA (id=0) and LayerB (id=4).&amp;nbsp; LayerA has three subLayers (ids=1,2,3) and LayerB has three subLayers (ids=4,5,6).&amp;nbsp; In my map layerA and subLayers 1 and 3 are visible and everything else is not so dynamicLayer's visibleLayers attribute equals [0,1,3].&lt;BR /&gt;&lt;BR /&gt;Below is my pseudo code for printing the map:&lt;BR /&gt;&lt;BR /&gt;var legendLayer = new esri.tasks.LegendLayer();&lt;BR /&gt;legendLayer.layerId = "dynamicLayer";&lt;BR /&gt;legendLayer.subLayerIds = [0,1,3];&lt;BR /&gt;&lt;BR /&gt;var printTemplate = new esri.tasks.PrintTemplate();&lt;BR /&gt;printTemplate.format = "JPG";&lt;BR /&gt;printTemplate.layout = "Letter ANSI A Landscape";&lt;BR /&gt;var layoutOptions = {TitleText: "Test Map",&amp;nbsp;&amp;nbsp;&amp;nbsp; scalebarUnit: 'Miles', legendLayers: [legendLayer]};&lt;BR /&gt;printTemplate.layoutOptions = layoutOptions;&lt;BR /&gt;&lt;BR /&gt;var printParams = new esri.tasks.PrintParameters();&lt;BR /&gt;printParams.map = map;&lt;BR /&gt;printParams.outSpatialReference = map.spatialReference;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;printParams.template = printTemplate;&lt;BR /&gt;&lt;BR /&gt;var printURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task";&lt;BR /&gt;var printTask = new esri.tasks.PrintTask(printURL);&lt;BR /&gt;printTask.execute(printParams, function(result) {&lt;BR /&gt; window.open(result.url + "?timestamp="+(new Date().getTime()));&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;The problem is that the resulting map will include a legend with layers 1,2, and 3 in it even though they are not visible or in the legendLayer.subLayerIds.&amp;nbsp; If I change the legendLayer.subLayerIds to [1,3] nothing in the legend shows up.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was having this exact problem until I changed a setting in my template mxd. When i checked 'on' the "Only display layers that are checked on in the Table Of Contents" in the legend properties this issue seemed to go away.[ATTACH=CONFIG]19640[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 18:55:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/potential-bug-in-print-task/m-p/423761#M38996</guid>
      <dc:creator>MichaelParry</dc:creator>
      <dc:date>2012-11-30T18:55:21Z</dc:date>
    </item>
  </channel>
</rss>

