<?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 Print/Write a map in a PDF document. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746362#M69051</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on reports related to tables and statistics.&lt;/P&gt;&lt;P&gt;I am conducting a search through dropdownlist selections and queries which is working just fine:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var selectQuery = new esri.tasks.Query();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;selectQuery.where = "NAME_ENGLISH LIKE '" + evt.target.value + "'";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;selectQuery.outFields = ["*"];&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var upc_fi_selectQuery = new esri.tasks.Query();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;upc_fi_selectQuery.spatialRelationship = selectQuery.SPATIAL_REL_CONTAINS; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AttFeatureLayer.selectFeatures(upc_fi_selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, function (features) &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// do this and that&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;After that I am running a script to write tables in a Windows document as follows (for instance)&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var newWin =&amp;nbsp; window.open("");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;newWin.document.write ("&amp;lt;label style='font-family: Trebuchet MS; font-weight:bold; font-size: 18px; color: #C0504D;'&amp;gt;Tourism Ecosystems Zone Details&amp;lt;/label&amp;gt;");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;newWin.document.write(Rep_T_tbTCA.outerHTML); // writing a table in a pdf document.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;newWin.document.write ('&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; newWin.document.write("&amp;lt;label style='font-family: Trebuchet MS; font-weight:bold; font-size: 18px; color: #C0504D; page-break-after: always'&amp;gt;Location of the the feature&amp;lt;/label&amp;gt;");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; newWin.document.write ('&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Till now everything works just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The map now is zoomed to the selected feature.&lt;/P&gt;&lt;P&gt;Now, I need to print the current extent of the map inside the pdf document:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTML&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;lt;div id="map" class="map" align="justify" &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; data-dojo-type="dijit/layout/ContentPane"&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Javascript&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;....&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var mapd = document.createElement("div");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; mapd.id = "map_rep";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; mapd.appendChild(document.getElementById("map"));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; newWin.document.write(mapd);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;....&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;I am getting the following as a response, which is not required result: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[object HTMLDivElement]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have seen other possibilities involving geoprocessing printing task using ArcGIS Online maps which is &lt;STRONG&gt;not&lt;/STRONG&gt; the case for me as I am using a map published as a map service and I have not interest in going through ArcGIS Online.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please kindly advice !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Specs:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;- ArcGIS Server 10.1 Enterprise.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;- JS API 3.11&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 21 Dec 2014 07:37:00 GMT</pubDate>
    <dc:creator>El_BoukfaouiReda</dc:creator>
    <dc:date>2014-12-21T07:37:00Z</dc:date>
    <item>
      <title>Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746362#M69051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on reports related to tables and statistics.&lt;/P&gt;&lt;P&gt;I am conducting a search through dropdownlist selections and queries which is working just fine:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var selectQuery = new esri.tasks.Query();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;selectQuery.where = "NAME_ENGLISH LIKE '" + evt.target.value + "'";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;selectQuery.outFields = ["*"];&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var upc_fi_selectQuery = new esri.tasks.Query();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;upc_fi_selectQuery.spatialRelationship = selectQuery.SPATIAL_REL_CONTAINS; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AttFeatureLayer.selectFeatures(upc_fi_selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, function (features) &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// do this and that&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;After that I am running a script to write tables in a Windows document as follows (for instance)&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var newWin =&amp;nbsp; window.open("");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;newWin.document.write ("&amp;lt;label style='font-family: Trebuchet MS; font-weight:bold; font-size: 18px; color: #C0504D;'&amp;gt;Tourism Ecosystems Zone Details&amp;lt;/label&amp;gt;");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;newWin.document.write(Rep_T_tbTCA.outerHTML); // writing a table in a pdf document.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;newWin.document.write ('&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; newWin.document.write("&amp;lt;label style='font-family: Trebuchet MS; font-weight:bold; font-size: 18px; color: #C0504D; page-break-after: always'&amp;gt;Location of the the feature&amp;lt;/label&amp;gt;");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; newWin.document.write ('&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Till now everything works just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The map now is zoomed to the selected feature.&lt;/P&gt;&lt;P&gt;Now, I need to print the current extent of the map inside the pdf document:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTML&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;lt;div id="map" class="map" align="justify" &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; data-dojo-type="dijit/layout/ContentPane"&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Javascript&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;....&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var mapd = document.createElement("div");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; mapd.id = "map_rep";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; mapd.appendChild(document.getElementById("map"));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; newWin.document.write(mapd);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;....&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;I am getting the following as a response, which is not required result: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[object HTMLDivElement]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have seen other possibilities involving geoprocessing printing task using ArcGIS Online maps which is &lt;STRONG&gt;not&lt;/STRONG&gt; the case for me as I am using a map published as a map service and I have not interest in going through ArcGIS Online.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please kindly advice !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Specs:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;- ArcGIS Server 10.1 Enterprise.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;- JS API 3.11&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 07:37:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746362#M69051</guid>
      <dc:creator>El_BoukfaouiReda</dc:creator>
      <dc:date>2014-12-21T07:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746363#M69052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Help in here please!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 06:40:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746363#M69052</guid>
      <dc:creator>El_BoukfaouiReda</dc:creator>
      <dc:date>2014-12-22T06:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746364#M69053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used the following code snippet to print the map on the document but I cannot limit the map to a certain frame.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var mapd = document.getElementById("map").innerHTML;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;newWin.document.write("&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;div id='divp'&amp;gt;"+mapd+"&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Dec 2014 04:35:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746364#M69053</guid>
      <dc:creator>El_BoukfaouiReda</dc:creator>
      <dc:date>2014-12-25T04:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746365#M69054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an example where we use our own server for the print task, not ArcGIS Online at all.&lt;/P&gt;&lt;P&gt;See if this is the type of thing that you are looking for:&lt;A href="http://maps.decaturil.gov/decaturprintmulti/" title="http://maps.decaturil.gov/decaturprintmulti/"&gt;Print a Map&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Click on the hammer icon and then the printer icon that will appear and then you can try out our print service. It's all html5. You can print a map in pdf&amp;nbsp; as well as several other formats.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Dec 2014 21:38:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746365#M69054</guid>
      <dc:creator>ChrisSergent</dc:creator>
      <dc:date>2014-12-26T21:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746366#M69055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You must be using the GIS Server PrintingTools from the Utilities in the example. This is extracting the map separately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could be working fine for me as well but the issue is that I need to export it to a &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; text-decoration: underline;"&gt;Windows document&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; text-decoration: underline;"&gt;(&lt;A href="http://www.w3schools.com/jsref/dom_obj_document.asp" title="http://www.w3schools.com/jsref/dom_obj_document.asp"&gt;HTML DOM Document Objects&lt;/A&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; on which I already wrote things, tables, labels, as specified above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;So my question is :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Is there a way to assign/extract/retrieve whatever map output result, that we get using the Utilities PrintingTools into the document using:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;EM style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;newWin.document.write(&amp;lt;themap&amp;gt;);&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;The following works, but the map is not rendering properly in the document(&lt;EM&gt;&lt;STRONG&gt;Ref.&lt;/STRONG&gt; reporting_map.png&lt;/EM&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var mapd = document.getElementById("map").innerHTML;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;newWin.document.write("&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;div id='divp'&amp;gt;"+mapd+"&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG alt="reporting_map.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/44799_reporting_map.png" style="width: 620px; height: 305px;" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Dec 2014 11:31:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746366#M69055</guid>
      <dc:creator>El_BoukfaouiReda</dc:creator>
      <dc:date>2014-12-29T11:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746367#M69056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would use the PrintTask to get a JPG image&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;A href="https://developers.arcgis.com/javascript/jsapi/printtemplate-amd.html#format" title="https://developers.arcgis.com/javascript/jsapi/printtemplate-amd.html#format"&gt;PrintTemplate | API Reference | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I would write the URL returned to an image tag (instead of trying to write a map in a div tag). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;table&amp;gt;&amp;lt;div&amp;gt;&amp;lt;etc&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;img src="'+ urlFromPrintTask +'" /&amp;gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Dec 2014 12:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746367#M69056</guid>
      <dc:creator>JoshHevenor</dc:creator>
      <dc:date>2014-12-29T12:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746368#M69057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I worked with the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;......Report being written.....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;var url = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://[IPAdress]:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task" rel="nofollow" target="_blank"&gt;http://[IPAdress]:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; var printMap = new esri.tasks.PrintTask(url);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; var params = new esri.tasks.PrintParameters();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; var template = new esri.tasks.PrintTemplate();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; //template.exportOptions = { dpi: 96};&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; template.format = "JPG";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; //template.layout = "Letter ANSI A Portrait";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; //template.preserveScale = true;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; //template.showAttribution = false;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; params.map = map;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; params.template = template;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; var pimg = new Image();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; var docp = newWin.document; // this represents the report being written&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; console.log(docp); // Report being written - Without image&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;printMap.execute(params, function(result)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pimg.src = result.url;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(result);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //newWin.document.write('&amp;lt;div&amp;gt;&amp;lt;img src="'+result.url+'"/&amp;gt;&amp;lt;/div&amp;gt;'); // this is not working!&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; docp.write('&amp;lt;div style="visibility:visible; width:100%; height:100%; display:block;"&amp;gt;&amp;lt;img&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style="visibility:visible; width:100%; height:100%;" src="'+result.url+'"/&amp;gt;&amp;lt;/div&amp;gt;'); // this is not working also&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //newWin.open(result.url); This is working just fine when I open a new window ! &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&lt;EM&gt;console.log(docp); // this is to witness that the image has been added to the report but not showing in the document:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG alt="imageinthereport.png" class="jive-image image-1" height="82" src="https://community.esri.com/legacyfs/online/45492_imageinthereport.png" style="float: none; height: 82px; width: 769.820895522388px;" width="770" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;.....Report being written.....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue is that I think what is inside the Execute function is processing only when I close my report document which has already been opened already as it is being written ! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help ! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Dec 2014 14:32:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746368#M69057</guid>
      <dc:creator>El_BoukfaouiReda</dc:creator>
      <dc:date>2014-12-30T14:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746369#M69058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does the URL you're returned have a map in it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think adding&amp;nbsp; &lt;STRONG&gt;template.layout = "MAP_ONLY";&lt;/STRONG&gt; won't hurt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Dec 2014 14:45:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746369#M69058</guid>
      <dc:creator>JoshHevenor</dc:creator>
      <dc:date>2014-12-30T14:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746370#M69059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes the URL I have returned have a map inside it and the it is getting exported successfully.&lt;/P&gt;&lt;P&gt;The issue is that it is not being written in the document only after I close "newWin" tab manually.&lt;/P&gt;&lt;P&gt;I think the map is taking time to be processed and this is not showing immediately in the windows document...&lt;/P&gt;&lt;P&gt;I am thinking of a way to save the image after being processed as an output by ArcGIS for Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your advice ! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Dec 2014 15:06:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746370#M69059</guid>
      <dc:creator>El_BoukfaouiReda</dc:creator>
      <dc:date>2014-12-30T15:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746371#M69060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hate to revive such an old thread, but did you ever find a solution for this?&amp;nbsp; It seems like you were getting close. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 17:24:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746371#M69060</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-11-17T17:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746372#M69061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tracy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Here is some code I use in a custom dialog element to get the map image and replace a static placeholder I have in my dialog with the map image once it is ready and once the image is returned I enable my print button on that dialog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;this.map.infoWindow.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var oWid = this.map.width;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var oHgt = this.map.height;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var printTask = new PrintTask('print service url');
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var template = new PrintTemplate();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.imgHeight = (740/oWid) * oHgt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; template.exportOptions = {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; width: 1542,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; height: (1542/oWid) * oHgt,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dpi: 200
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; template.format = "jpg";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; template.layout = "MAP_ONLY";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; template.preserveScale = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; template.showAttribution = false;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var params = new PrintParameters();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.map = this.map;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.template = template;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printTask.execute(params, lang.hitch(this, this.printResult));

printResult: function(rsltURL){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var mapImg = domConstruct.toDom('&amp;lt;img src="'+rsltURL.url+'" border="0" style="width:740px;height:'+this.imgHeight+'px;"/&amp;gt;');
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; domConstruct.place(mapImg, dom.byId('mapImgDiv'), 'replace');
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(typeof has('android') === 'undefined'){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; domClass.replace(this.printBtnNode, 'myprint-btn', 'myprint-btn-loading');
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; domAttr.set(this.printBtnNode, 'title', 'Print Tax Report...');
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.own(on(this.printBtnNode, 'click', lang.hitch(this, this._printReport)));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746372#M69061</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T07:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Print/Write a map in a PDF document.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746373#M69062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That works for me.&amp;nbsp; I figured it was a matter of waiting until there was output before proceeding. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 17:46:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/print-write-a-map-in-a-pdf-document/m-p/746373#M69062</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-11-17T17:46:01Z</dc:date>
    </item>
  </channel>
</rss>

