You can print the maps generated by FusionMaps at client side using the print() method of each map. In this section, we'll show you how to attain this.

The first step is to set registerWithJS flag of map as 1, as shown under:

<div id="map1div">
   FusionMaps
</div>
<script language="JavaScript">
   var map1 = new FusionMaps("../../FusionMaps/FCMap_World.swf", "map1Id", "400", "300", "0", "1");
   map1.setDataURL("MapData.xml");
   map1.render("map1div");
</script>

Thereafter, you can invoke the print() method of the map object to print it.

<HTML>
<HEAD>
   <TITLE>FusionMaps & JavaScript - Printing Map Example</TITLE>
   <SCRIPT LANGUAGE="Javascript" SRC="../../FusionMaps/FusionMaps.js"></SCRIPT>
   <SCRIPT LANGUAGE="JavaScript">
      function printMap(){
         //Get map from its ID
         var mapToPrint = getMapFromId("map1Id");
         mapToPrint.print();
      }

      </SCRIPT>
</HEAD>
<BODY>
   <CENTER>
   <h2>FusionMaps and JavaScript - Basic Example</h2>

   <div id="map1div">
      FusionMaps
   </div>
   <script language="JavaScript">
      var map1 = new FusionMaps("../../FusionMaps/FCMap_World.swf", "map1Id", "400", "300", "0", "1");
      map1.setDataURL("MapData.xml");
      map1.render("map1div");
   </script>
   <center><input type='button' value='Print Map' onClick='javascript:printMap();'></center>
   
   </CENTER>
</BODY>
</HTML>

In the above code, we're first creating a world map with DOM Id as map1Id. We also register it with JavaScript. Thereafter, we've created a HTML button, which when clicked invokes the local printMap() function. This function just gets the reference to the map using getMapFromId() function and finally invokes the print() method on the map.

If you intend to print the map soon after the map has loaded, make sure to put the print() command in FC_Rendered event; otherwise, the printing will get invoked before the map has started rendering, and you'll get a blank print output.

The entire thing happens at client side, without any page refreshes.