Printing a Map


Printing a Map

The sample code below demonstrates how to print the contents of a Map control using the print() method of the client-side API.

 

<html>
<body>
<script>
function printMap()
{
     var map = AspMap.getMap('<%=map.ClientID%>');
        map.print();
}
</script>
<button onclick="printMap()"> Print </button>

<form id="Form1" method="post" runat="server">
<aspmap:Map id="map" runat="server" Width="600px" Height="400px"></aspmap:Map>
</form>
</body>
</html>
Printing a Page Area

The sample code below demonstrates how to print an area of a page that contains a Map control and other HTML content using the printPageArea() method of the client-side API. The DIV tag with the printArea ID contains the area that will be printed. See the PrintPageArea.aspx sample for additional information.

<html>
<body>
<script>
function printPageArea()
{
     var map = AspMap.getMap('<%=map.ClientID%>');
        map.printPageArea("printArea");
}
</script>
<button onclick="printPageArea()"> Print </button>

<form id="Form1" method="post" runat="server">
<div id="printArea">
<h3>World Map</h3>
<aspmap:Map id="map" runat="server" Width="600px" Height="400px"></aspmap:Map>
</div>
</form>
</body>
</html>
© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)