<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>VEMap.SetPrintOptions()</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
<script type="text/javascript">
var map = null;
var shape = null;
var pinCenter = null;
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
// Add a pushpin
pinCenter = new VELatLong(45.01188,-111.06687);
shape = new VEShape(VEShapeType.Pushpin, pinCenter);
map.AddShape(shape);
//Set the map view to see the pushpin
map.SetCenter(pinCenter);
}
function PrintMap()
{
//Enable printing
var printOpt = new VEPrintOptions(true);
map.SetPrintOptions(printOpt);
// Print the map
window.print();
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:600px; height:400px;"></div>
<input id="btnprint" type="button" value="Click to print the map" onclick="PrintMap();"/>
</body>
</html>