1

I have assembled javascript code that will display route and along with the directions. How do I enable the print option for these directions? I went through the documentation but couldn't locate any option that will allow the user to print the directions.

So far I have rendered a map and listed the directions next to it.

Is there any option to enable the print button?

Here is my output: Map and Directions

Here is my script.

function loadMapScenario() {
            var map = new Microsoft.Maps.Map(document.getElementById("myMap"), {
                /* No need to set credentials if already passed in URL */
                center: new Microsoft.Maps.Location(40.418386, -80.019262),
                zoom: 160 });
            Microsoft.Maps.loadModule("Microsoft.Maps.Directions", function () {
                var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
                directionsManager.setRenderOptions(
                        { 
                            itineraryContainer: document.getElementById("printoutPanel"),
                            displayDisclaimer:false,
                            showInputPanel:true,
                            drivingPolylineOptions: 
                            {
                            strokeColor: 'green',
                            strokeThickness: 6
                            },
                    }
                        );
                directionsManager.setRequestOptions({
                    routeMode: Microsoft.Maps.Directions.RouteMode.truck,
                    vehicleSpec: {
                        vehicleAxles: 3,
                        vehicleTrailers: 2,
                        vehicleSemi: true
                    }
                });
                var wp1 = new Microsoft.Maps.Directions.Waypoint({
                    address: "590 Crane Ave, Pittsburgh, PA",
                    location: new Microsoft.Maps.Location(40.419228, -80.018138)
                });
                var wp2 = new Microsoft.Maps.Directions.Waypoint({
                    address: "600 Forbes Ave, Pittsburgh, PA",
                    location: new Microsoft.Maps.Location(40.033230, 75.622310)
                });
                var wp3 = new Microsoft.Maps.Directions.Waypoint({
    address: "600 Exton Commons, Exton, PA",
    location: new Microsoft.Maps.Location(40.033230, 75.622310)
});
                directionsManager.addWaypoint(wp1);
                //directionsManager.addWaypoint(wp2);
                directionsManager.addWaypoint(wp3);
                directionsManager.calculateDirections();
            });
            $("#printoutPanel").hide();
            $("#btnPrint").hide()
        }
abhi
  • 3,082
  • 6
  • 47
  • 73

0 Answers0