首页 > 解决方案 > 如何允许用户从 Bing 地图打印路线?

问题描述

我已经组装了将显示路线和方向的 javascript 代码。如何为这些方向启用打印选项?我浏览了文档,但找不到任何允许用户打印方向的选项。

到目前为止,我已经渲染了一张地图并列出了旁边的方向。

有没有启用打印按钮的选项?

这是我的输出: 地图和方向

这是我的脚本。

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

标签: javascriptprintingbing-mapsmap-directions

解决方案


推荐阅读