ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.[Solved] Want to use print functionality for Google Map in ASP.Net<p>This is the only example that actually Prints.</p> <div class="demo_block"> <pre class="brush: html"> &lt;script type=&#34;text/javascript&#34; src=&#34;https://maps.googleapis.com/maps/api/js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var markers = [ { &#34;title&#34;: &#39;Aksa Beach&#39;, &#34;lat&#34;: &#39;19.1759668&#39;, &#34;lng&#34;: &#39;72.79504659999998&#39;, &#34;description&#34;: &#39;Aksa Beach is a popular beach and a vacation spot in Aksa village at Malad, Mumbai.&#39; }, { &#34;title&#34;: &#39;Juhu Beach&#39;, &#34;lat&#34;: &#39;19.0883595&#39;, &#34;lng&#34;: &#39;72.82652380000002&#39;, &#34;description&#34;: &#39;Juhu Beach is one of favourite tourist attractions situated in Mumbai.&#39; }, { &#34;title&#34;: &#39;Girgaum Beach&#39;, &#34;lat&#34;: &#39;18.9542149&#39;, &#34;lng&#34;: &#39;72.81203529999993&#39;, &#34;description&#34;: &#39;Girgaum Beach commonly known as just Chaupati is one of the most famous public beaches in Mumbai.&#39; }, { &#34;title&#34;: &#39;Jijamata Udyan&#39;, &#34;lat&#34;: &#39;18.979006&#39;, &#34;lng&#34;: &#39;72.83388300000001&#39;, &#34;description&#34;: &#39;Jijamata Udyan is situated near Byculla station is famous as Mumbai (Bombay) Zoo.&#39; }, { &#34;title&#34;: &#39;Sanjay Gandhi National Park&#39;, &#34;lat&#34;: &#39;19.2147067&#39;, &#34;lng&#34;: &#39;72.91062020000004&#39;, &#34;description&#34;: &#39;Sanjay Gandhi National Park is a large protected area in the northern part of Mumbai city.&#39; } ]; window.onload = function () { LoadMap(); } var map, mapOptions; function LoadMap() { mapOptions = { center: new google.maps.LatLng(19.0883595, 72.82652380000002), zoom: 10, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById(&#34;dvMap&#34;), mapOptions); for (var i = 0; i &lt; markers.length; i++) { var data = markers[i]; var myLatlng = new google.maps.LatLng(data.lat, data.lng); var marker = new google.maps.Marker({ position: myLatlng, map: map, title: data.title }); } }; function Print() { //URL of Google Static Maps. var staticMapUrl = &#34;https://maps.googleapis.com/maps/api/staticmap&#34;; //Set the Google Map Center. staticMapUrl += &#34;?center=&#34; + mapOptions.center.lat() + &#34;,&#34; + mapOptions.center.lng(); //Set the Google Map Size. staticMapUrl += &#34;&amp;size=220x350&#34;; //Set the Google Map Zoom. staticMapUrl += &#34;&amp;zoom=&#34; + mapOptions.zoom; //Set the Google Map Type. staticMapUrl += &#34;&amp;maptype=&#34; + mapOptions.mapTypeId; //Loop and add Markers. for (var i = 0; i &lt; markers.length; i++) { staticMapUrl += &#34;&amp;markers=color:red|&#34; + markers[i].lat + &#34;,&#34; + markers[i].lng; } //Display the Image of Google Map. var imgMap = document.getElementById(&#34;imgMap&#34;); imgMap.src = staticMapUrl; imgMap.style.display = &#34;block&#34;; //Print the Google Map. var divContents = document.getElementById(&#34;dvMapImage&#34;).innerHTML; var printWindow = window.open(&#39;&#39;, &#39;&#39;, &#39;height=500,width=400&#39;); printWindow.document.write(&#39;&lt;html&gt;&lt;head&gt;&lt;title&gt;Google Maps&lt;/title&gt;&#39;); printWindow.document.write(&#39;&lt;/head&gt;&lt;body &gt;&#39;); printWindow.document.write(divContents); printWindow.document.write(&#39;&lt;/body&gt;&lt;/html&gt;&#39;); printWindow.document.close(); printWindow.print(); imgMap.style.display = &#34;none&#34;; }; &lt;/script&gt; &lt;table border=&#34;0&#34; cellpadding=&#34;0&#34; cellspacing=&#34;0&#34;&gt; &lt;tr&gt; &lt;td&gt; &lt;div id=&#34;dvMap&#34; style=&#34;width: 220px; height: 350px&#34;&gt; &lt;/div&gt; &lt;/td&gt; &lt;td&gt; &amp;nbsp; &amp;nbsp; &lt;/td&gt; &lt;td&gt; &lt;div id=&#34;dvMapImage&#34;&gt; &lt;img id=&#34;imgMap&#34; alt=&#34;&#34; style = &#34;display:none&#34;/&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt; &lt;input type=&#34;button&#34; id=&#34;btnPrint&#34; value=&#34;Print&#34; onclick=&#34;Print()&#34; /&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/425121/Solved-Want-to-use-print-functionality-for-Google-Map-in-ASPNet/https://www.aspforums.net:443/Threads/425121/Solved-Want-to-use-print-functionality-for-Google-Map-in-ASPNet/Tue, 20 Mar 2018 04:32:06 GMT[Solved] Want to use print functionality for Google Map in ASP.Net<p>Hello&nbsp;</p> <p>Thanks for your support.</p> <p>But it is not working i dont understand what to do.</p> <p>I have tried another javascript function like below to print map.</p> <p>&nbsp;</p> <pre class="brush: js"> function PrintDoc() { var toPrint = document.getElementById(&#39;dvMap&#39;); var popupWin = window.open(&#39;&#39;, &#39;_blank&#39;, &#39;width=700,height=400,location=no,left=200px&#39;); popupWin.document.open(); popupWin.document.write(&#39;&lt;html&gt;&lt;title&gt;::Preview::&lt;/title&gt;&lt;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;print.css&#34; /&gt;&lt;/head&gt;&lt;body onload=&#34;window.print()&#34;&gt;&#39;) popupWin.document.write(toPrint.innerHTML); popupWin.document.write(&#39;&lt;/html&gt;&#39;); popupWin.document.close(); } function PrintPreview() { var toPrint = document.getElementById(&#39;dvMap&#39;); var popupWin = window.open(&#39;&#39;, &#39;_blank&#39;, &#39;width=700,height=400,location=no,left=200px&#39;); popupWin.document.open(); popupWin.document.write(&#39;&lt;html&gt;&lt;title&gt;::Print Preview::&lt;/title&gt;&lt;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;Print.css&#34; media=&#34;screen&#34;/&gt;&lt;/head&gt;&lt;body&#34;&gt;&#39;) popupWin.document.write(toPrint.innerHTML); popupWin.document.write(&#39;&lt;/html&gt;&#39;); //directionsService.route(request, function(response, status) { // if (status == google.maps.DirectionsStatus.OK) { // directionsDisplay.setDirections(response); // } //}); popupWin.document.close(); } </pre> <p>So i got an answer for that particuler issue.</p> <p>Now i have to mark any answer??Please let me know</p> <p>Thanks</p>https://www.aspforums.net:443/Threads/425121/Solved-Want-to-use-print-functionality-for-Google-Map-in-ASPNet/https://www.aspforums.net:443/Threads/425121/Solved-Want-to-use-print-functionality-for-Google-Map-in-ASPNet/Tue, 20 Mar 2018 23:48:41 GMT