如何允许用户从必应地图打印路线?

时间:2019-07-10 15:46:30

标签: javascript printing bing-maps map-directions

我已经汇编了javascript代码,该代码将显示路线和路线。如何启用这些指示的打印选项?我经历了documentation,但是找不到任何允许用户打印路线的选项。

到目前为止,我已经绘制了一张地图,并在其旁边列出了方向。

是否有启用打印按钮的选项?

这是我的输出: Map and Directions

这是我的剧本。

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()
        }

0 个答案:

没有答案