<?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: Print widget generates blank output without error in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-widget-generates-blank-output-without-error/m-p/1417599#M84471</link>
    <description>&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;Thanks a lot for your reply. Much appreciated for your thoughts! That is a good catch about cache difference between two types of layers. Maybe that is an alternative before MapImageLayer can be printed properly in future.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Just repost the working version of the same print code below for others' reference in case encountering the similar issue.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#########################Online testing code#########################&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;html lang="en"&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;meta charset="utf-8" /&amp;gt;&lt;BR /&gt;&amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Print widget | Sample | ArcGIS Maps SDK for JavaScript 4.28&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;link rel="stylesheet" href="&lt;A href="https://js.arcgis.com/4.28/esri/themes/light/main.css" target="_blank"&gt;https://js.arcgis.com/4.28/esri/themes/light/main.css&lt;/A&gt;" /&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;html,&lt;BR /&gt;body,&lt;BR /&gt;#viewDiv {&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;height: 100%;&lt;BR /&gt;width: 100%;&lt;BR /&gt;overflow: hidden;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script src="&lt;A href="https://js.arcgis.com/4.28/" target="_blank"&gt;https://js.arcgis.com/4.28/&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;require(["esri/views/MapView", "esri/widgets/Print", "esri/WebMap", "esri/Map", "esri/rest/support/PrintParameters", "esri/rest/support/PrintTemplate", "esri/rest/support/ImageParameters", "esri/layers/TileLayer"], (MapView, Print, WebMap, Map, PrintParameters, PrintTemplate, ImageParameters, TileLayer) =&amp;gt; {&lt;BR /&gt;var map = new Map({});&lt;BR /&gt;var imageParameters = new ImageParameters();&lt;BR /&gt;imageParameters.layerIds = [];&lt;BR /&gt;imageParameters.layerIds.push(0);&lt;BR /&gt;imageParameters.layerOption = ImageParameters.LAYER_OPTION_SHOW;&lt;BR /&gt;imageParameters.transparent = true;&lt;BR /&gt;var url = "&lt;A href="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" target="_blank"&gt;https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;";&lt;BR /&gt;var layer = new TileLayer({ url: url, customParameters: imageParameters });&lt;BR /&gt;map.add(layer);&lt;BR /&gt;const view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: map,&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.when(() =&amp;gt; {&lt;BR /&gt;const print = new Print({&lt;BR /&gt;view: view,&lt;BR /&gt;// specify your own print service&lt;BR /&gt;printServiceUrl:&lt;BR /&gt;"&lt;A href="https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task" target="_blank"&gt;https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task&lt;/A&gt;"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Add widget to the top right corner of the view&lt;BR /&gt;view.ui.add(print, "top-right");&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body class="calcite"&amp;gt;&lt;BR /&gt;&amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 01 May 2024 15:41:39 GMT</pubDate>
    <dc:creator>SamuelAG</dc:creator>
    <dc:date>2024-05-01T15:41:39Z</dc:date>
    <item>
      <title>Print widget generates blank output without error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-widget-generates-blank-output-without-error/m-p/1417232#M84461</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am new to ArcGIS JavaScript API and trying to migrate from 3.X to 4.X. Have some problems with the print service in 4.X.&lt;/P&gt;&lt;P&gt;Try to add a MapImageLayer (esri/layers/MapImageLayer) into a Map (esri/Map) object then print into an image with this print API&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-print.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-print.html&lt;/A&gt;&amp;nbsp;. However I always got blank output image file without any http errors.&amp;nbsp; However, if I create the Map object with basemap like:&lt;/P&gt;&lt;P&gt;new Map({basemap: "topo-vector"});&lt;/P&gt;&lt;P&gt;then it can print something out. I tried the following code with the ArcGIS online sample website (&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-print" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-print&lt;/A&gt;) which uses print widget and got same blank output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anything wrong with the code or miss anything? Any suggestions would be great.&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;BR /&gt;&lt;BR /&gt;#########################Online testing code#########################&lt;/P&gt;&lt;P&gt;&amp;lt;html lang="en"&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;meta charset="utf-8" /&amp;gt;&lt;BR /&gt;&amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Print widget | Sample | ArcGIS Maps SDK for JavaScript 4.29&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;link rel="stylesheet" href="&lt;A href="https://js.arcgis.com/4.29/esri/themes/light/main.css" target="_blank" rel="noopener"&gt;https://js.arcgis.com/4.29/esri/themes/light/main.css&lt;/A&gt;" /&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;html,&lt;BR /&gt;body,&lt;BR /&gt;#viewDiv {&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;height: 100%;&lt;BR /&gt;width: 100%;&lt;BR /&gt;overflow: hidden;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script src="&lt;A href="https://js.arcgis.com/4.28/" target="_blank" rel="noopener"&gt;https://js.arcgis.com/4.28/&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;require(["esri/views/MapView", "esri/widgets/Print", "esri/WebMap", "esri/Map", "esri/rest/support/PrintParameters", "esri/rest/support/PrintTemplate","esri/layers/MapImageLayer", "esri/rest/support/ImageParameters"], (MapView, Print, WebMap, Map, PrintParameters, PrintTemplate, MapImageLayer,ImageParameters) =&amp;gt; {&lt;BR /&gt;var map = new Map();&lt;BR /&gt;var imageParameters = new ImageParameters();&lt;BR /&gt;imageParameters.layerIds = [];&lt;BR /&gt;imageParameters.layerIds.push(0);&lt;BR /&gt;imageParameters.layerOption = ImageParameters.LAYER_OPTION_SHOW;&lt;BR /&gt;imageParameters.transparent = true;&lt;BR /&gt;var url = "&lt;A href="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" target="_blank" rel="noopener"&gt;https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;";&lt;BR /&gt;var layer = new MapImageLayer({ url: url, customParameters: imageParameters });&lt;BR /&gt;map.add(layer);&lt;BR /&gt;const view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: map&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;view.when(() =&amp;gt; {&lt;BR /&gt;const print = new Print({&lt;BR /&gt;view: view,&lt;BR /&gt;// specify your own print service&lt;BR /&gt;printServiceUrl:&lt;BR /&gt;"&lt;A href="https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task" target="_blank" rel="noopener"&gt;https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task&lt;/A&gt;"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Add widget to the top right corner of the view&lt;BR /&gt;view.ui.add(print, "top-right");&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body class="calcite"&amp;gt;&lt;BR /&gt;&amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 19:22:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-widget-generates-blank-output-without-error/m-p/1417232#M84461</guid>
      <dc:creator>SamuelAG</dc:creator>
      <dc:date>2024-04-30T19:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Print widget generates blank output without error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-widget-generates-blank-output-without-error/m-p/1417554#M84470</link>
      <description>&lt;P&gt;Not sure exactly why it's not working.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I switched the MapImageLayer to &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html" target="_self"&gt;TileLayer&lt;/A&gt; and it work.&amp;nbsp; Perhaps the large MapImageLayer is not rendering fast enough during the print/export?&amp;nbsp; A TileLayer will use a cache in order to render faster.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 14:27:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-widget-generates-blank-output-without-error/m-p/1417554#M84470</guid>
      <dc:creator>MatthewDriscoll</dc:creator>
      <dc:date>2024-05-01T14:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Print widget generates blank output without error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-widget-generates-blank-output-without-error/m-p/1417599#M84471</link>
      <description>&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;Thanks a lot for your reply. Much appreciated for your thoughts! That is a good catch about cache difference between two types of layers. Maybe that is an alternative before MapImageLayer can be printed properly in future.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Just repost the working version of the same print code below for others' reference in case encountering the similar issue.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#########################Online testing code#########################&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;html lang="en"&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;meta charset="utf-8" /&amp;gt;&lt;BR /&gt;&amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Print widget | Sample | ArcGIS Maps SDK for JavaScript 4.28&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;link rel="stylesheet" href="&lt;A href="https://js.arcgis.com/4.28/esri/themes/light/main.css" target="_blank"&gt;https://js.arcgis.com/4.28/esri/themes/light/main.css&lt;/A&gt;" /&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;html,&lt;BR /&gt;body,&lt;BR /&gt;#viewDiv {&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;height: 100%;&lt;BR /&gt;width: 100%;&lt;BR /&gt;overflow: hidden;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script src="&lt;A href="https://js.arcgis.com/4.28/" target="_blank"&gt;https://js.arcgis.com/4.28/&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;require(["esri/views/MapView", "esri/widgets/Print", "esri/WebMap", "esri/Map", "esri/rest/support/PrintParameters", "esri/rest/support/PrintTemplate", "esri/rest/support/ImageParameters", "esri/layers/TileLayer"], (MapView, Print, WebMap, Map, PrintParameters, PrintTemplate, ImageParameters, TileLayer) =&amp;gt; {&lt;BR /&gt;var map = new Map({});&lt;BR /&gt;var imageParameters = new ImageParameters();&lt;BR /&gt;imageParameters.layerIds = [];&lt;BR /&gt;imageParameters.layerIds.push(0);&lt;BR /&gt;imageParameters.layerOption = ImageParameters.LAYER_OPTION_SHOW;&lt;BR /&gt;imageParameters.transparent = true;&lt;BR /&gt;var url = "&lt;A href="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" target="_blank"&gt;https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;";&lt;BR /&gt;var layer = new TileLayer({ url: url, customParameters: imageParameters });&lt;BR /&gt;map.add(layer);&lt;BR /&gt;const view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: map,&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.when(() =&amp;gt; {&lt;BR /&gt;const print = new Print({&lt;BR /&gt;view: view,&lt;BR /&gt;// specify your own print service&lt;BR /&gt;printServiceUrl:&lt;BR /&gt;"&lt;A href="https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task" target="_blank"&gt;https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task&lt;/A&gt;"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Add widget to the top right corner of the view&lt;BR /&gt;view.ui.add(print, "top-right");&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body class="calcite"&amp;gt;&lt;BR /&gt;&amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 15:41:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-widget-generates-blank-output-without-error/m-p/1417599#M84471</guid>
      <dc:creator>SamuelAG</dc:creator>
      <dc:date>2024-05-01T15:41:39Z</dc:date>
    </item>
  </channel>
</rss>

