VEMap.SetPrintOptions Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

This method controls how the map is printed.

VEMap.SetPrintOptions(printOptions);

Parameters

Parameter Description

printOptions

A VEPrintOptions Class specifying the print options to set.

Remarks

The default value for the VEPrintOptions.EnablePrinting Property is false, which means printing support is off by default.

There may be a decrease in the performance of the map control if the VEPrintOptions.EnablePrinting Property is equal to true.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></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>

See Also

Concepts

VEPrintOptions Class