<?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: How to print contents of InfoWindow/Popup? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85388#M7738</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Kelly,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply and code. It was a big help.&amp;nbsp; I copied it into my app (based on the Basic Viewer template), but for some reason your "printPopupContents" function didn't work for me.&amp;nbsp; I got the following in Firebug:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]--&amp;gt;inside printPopupContents&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;popupContent: [object HTMLDivElement]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;div id="esri_dijit__PopupRenderer_1" class="esriViewPopup" widgetid="esri_dijit__PopupRenderer_1"&amp;gt;[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The browser window that opened showed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT][object HTMLDivElement][/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure what's happening there...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But, I created my own "printPopupContents" function and used the class attribute to query the dom element (the table inside the popup). Clunkier than your code but it seems to work fine.&amp;nbsp; Here's my function, maybe it helps someone else.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function printPopupContents(){
&amp;nbsp; console.log("--&amp;gt;inside printPopupContents");
&amp;nbsp; 
&amp;nbsp; var popupTable = dojo.query(".attrTable");
&amp;nbsp; console.log("popupTable.length: " + popupTable.length);
&amp;nbsp; console.log("popupTable[0].innerHTML: " + popupTable[0].innerHTML);
&amp;nbsp; popupTableContent = "&amp;lt;table&amp;gt;" + popupTable[0].innerHTML + "&amp;lt;/table&amp;gt;";
&amp;nbsp; 
&amp;nbsp; popupContent = '&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Rezoning Print Window&amp;lt;/title&amp;gt;';
&amp;nbsp; /*optional stylesheet*/ 
&amp;nbsp; //popupContent += '&amp;lt;link rel="stylesheet" type="text/css" href="css/rezoning.css" /&amp;gt;';
&amp;nbsp; popupContent +='&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;';
&amp;nbsp; popupContent += popupTableContent
&amp;nbsp; popupContent +='&amp;lt;/br&amp;gt;&amp;lt;div&amp;gt;';
&amp;nbsp; popupContent += configOptions.owner;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; popupContent +='&amp;lt;/div&amp;gt;';&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; popupContent +='&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;';
&amp;nbsp; 
&amp;nbsp; //write contents to new page for printing
&amp;nbsp; var newWindow = window.open("", "PopupContents");
&amp;nbsp; console.log(popupContent);
&amp;nbsp; newWindow.document.write(popupContent);
&amp;nbsp; 
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 23:17:25 GMT</pubDate>
    <dc:creator>JoanSteinbacher</dc:creator>
    <dc:date>2021-12-10T23:17:25Z</dc:date>
    <item>
      <title>How to print contents of InfoWindow/Popup?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85384#M7734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What's the easiest way to print the contents of an InfoWindow or Popup?&amp;nbsp; I would think that ESRI would add a "print" link as an option (similar to the "Zoom to" link that's provided in the Popup). Am I missing something easy or do I have to code this myself somehow?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 13:54:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85384#M7734</guid>
      <dc:creator>JoanSteinbacher</dc:creator>
      <dc:date>2013-04-04T13:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to print contents of InfoWindow/Popup?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85385#M7735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't think you can print from the Info Window, though I agree it could be handy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However you can select all in the info window and right click and select copy.&amp;nbsp; Then paste the copy into an Excel document and print it from there. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What's the easiest way to print the contents of an InfoWindow or Popup?&amp;nbsp; I would think that ESRI would add a "print" link as an option (similar to the "Zoom to" link that's provided in the Popup). Am I missing something easy or do I have to code this myself somehow?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 15:58:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85385#M7735</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2013-04-04T15:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to print contents of InfoWindow/Popup?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85386#M7736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One option would be to add a new link to the popup window that allows users to print the popup contents. You can add a new link next to the existing popup zoomTo link. Here's an jsfiddle that shows this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://jsfiddle.net/drUvW/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://jsfiddle.net/drUvW/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And here's info on how it works: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var printLink = dojo.create("a", {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "class": "action",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "innerHTML": "Print",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "href": "javascript:void(0);"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, dojo.query(".actionList", map.infoWindow.domNode)[0] );

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next register a function that will be executed when the print link is clicked:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(printLink, "onclick", printPopupContents);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the function you can get the selected feature then use the getContent method to get the info window contents for that feature. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; function printPopupContents(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var feature = map.infoWindow.getSelectedFeature();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var popupContent = feature.getContent();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //write contents to new page for printing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var newWindow = window.open("", "PopupContents");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(popupContent);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newWindow.document.write(popupContent);


&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:17:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85386#M7736</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2021-12-10T23:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to print contents of InfoWindow/Popup?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85387#M7737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It'd be really helpful if the print option captured popup windows. We used to use the Flex API and it had that capability, so everyone is used to having that available.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 15:44:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85387#M7737</guid>
      <dc:creator>AlexGilvarry</dc:creator>
      <dc:date>2013-04-08T15:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to print contents of InfoWindow/Popup?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85388#M7738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Kelly,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply and code. It was a big help.&amp;nbsp; I copied it into my app (based on the Basic Viewer template), but for some reason your "printPopupContents" function didn't work for me.&amp;nbsp; I got the following in Firebug:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]--&amp;gt;inside printPopupContents&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;popupContent: [object HTMLDivElement]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;div id="esri_dijit__PopupRenderer_1" class="esriViewPopup" widgetid="esri_dijit__PopupRenderer_1"&amp;gt;[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The browser window that opened showed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT][object HTMLDivElement][/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure what's happening there...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But, I created my own "printPopupContents" function and used the class attribute to query the dom element (the table inside the popup). Clunkier than your code but it seems to work fine.&amp;nbsp; Here's my function, maybe it helps someone else.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function printPopupContents(){
&amp;nbsp; console.log("--&amp;gt;inside printPopupContents");
&amp;nbsp; 
&amp;nbsp; var popupTable = dojo.query(".attrTable");
&amp;nbsp; console.log("popupTable.length: " + popupTable.length);
&amp;nbsp; console.log("popupTable[0].innerHTML: " + popupTable[0].innerHTML);
&amp;nbsp; popupTableContent = "&amp;lt;table&amp;gt;" + popupTable[0].innerHTML + "&amp;lt;/table&amp;gt;";
&amp;nbsp; 
&amp;nbsp; popupContent = '&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Rezoning Print Window&amp;lt;/title&amp;gt;';
&amp;nbsp; /*optional stylesheet*/ 
&amp;nbsp; //popupContent += '&amp;lt;link rel="stylesheet" type="text/css" href="css/rezoning.css" /&amp;gt;';
&amp;nbsp; popupContent +='&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;';
&amp;nbsp; popupContent += popupTableContent
&amp;nbsp; popupContent +='&amp;lt;/br&amp;gt;&amp;lt;div&amp;gt;';
&amp;nbsp; popupContent += configOptions.owner;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; popupContent +='&amp;lt;/div&amp;gt;';&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; popupContent +='&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;';
&amp;nbsp; 
&amp;nbsp; //write contents to new page for printing
&amp;nbsp; var newWindow = window.open("", "PopupContents");
&amp;nbsp; console.log(popupContent);
&amp;nbsp; newWindow.document.write(popupContent);
&amp;nbsp; 
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:17:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/85388#M7738</guid>
      <dc:creator>JoanSteinbacher</dc:creator>
      <dc:date>2021-12-10T23:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to print contents of InfoWindow/Popup?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/1112598#M75128</link>
      <description>&lt;P&gt;Does anyone know the 4x equivalent for this code?&amp;nbsp; It looks like what I need to grab the pop-up contains and populate a new page for printing&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function printPopupContents(){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var feature = map.infoWindow.getSelectedFeature();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var popupContent = feature.getContent();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //write contents to new page for printing&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var newWindow = window.open("", "PopupContents");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(popupContent);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newWindow.document.write(popupContent);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 23:31:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-print-contents-of-infowindow-popup/m-p/1112598#M75128</guid>
      <dc:creator>RyanBohan</dc:creator>
      <dc:date>2021-10-29T23:31:56Z</dc:date>
    </item>
  </channel>
</rss>

