地图打印仅地图4X

            var fullmap = dom.byId("Print");
            fullmap.onclick = function () {
                var printTask = new PrintTask({
                    url: "http://localhost:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
                });
                var template = new PrintTemplate({
                    exportOptions: {
                        width: 950,
                        height: 850,
                        dpi: 96
                    },
                    format: "pdf"
                    //layout: "a3-landscape",
                    //layoutOptions: {
                    //    titleText: "biaoti",
                    //    authorText: "leejianghua"
                    //},
                    //preserveScale: false
                });
                var params = new PrintParameters({
                    view: view,
                    template: template
                });
                printTask.execute(params).then(result, errorResult);
                function result(evt) {
                    console.log(evt);
                    window.open(evt.url, "_blank");  //在新的标签页打开打印连接
                }
                function errorResult(err) {
                    console.log(err);
                }
            }

猜你喜欢

转载自www.cnblogs.com/leebokeyuan/p/12147957.html