arcgis打印服务

<script>
    function print1() {
        require([
               "esri/map",
                "esri/dijit/Print",
                "esri/tasks/PrintTask",
                "esri/tasks/PrintParameters",
                "esri/tasks/PrintTemplate",
                "esri/layers/FeatureLayer",
                "esri/layers/ArcGISDynamicMapServiceLayer",
                "esri/tasks/Geoprocessor",
                "esri/SpatialReference",
                "esri/symbols/TextSymbol",
                "esri/symbols/Font",
                "esri/graphic",
                "esri/geometry/Point",
                "esri/symbols/SimpleMarkerSymbol",
                "esri/symbols/SimpleLineSymbol",
                "esri/Color",
                "dojo/domReady!"
        ],
            function (
                   Map,
                   Print,
                    PrintTask,
                    PrintParameters,
                    PrintTemplate,
                    FeatureLayer,
                    ArcGISDynamicMapServiceLayer,
                    Geoprocessor,
                    TextSymbol,
                    Font,
                    Graphic,
                    Point,
                    SimpleMarkerSymbol,
                    SimpleLineSymbol,
                    Color
            ) {
                var printurl = top.Robin.Setting.GlobalSetting.BaseMapServices.Printing.url;
                var printTask = new PrintTask(printurl);
                var template = new PrintTemplate();
                template.exportOptions = {
                    width: 800,
                    height: 600,
                    dpi: 96
                };
                template.format = "PDF";
                template.layout = "MAP_ONLY";  //MAP_ONLY    print
                template.preserveScale = false;
                var params = new PrintParameters();
                params.map = top.Robin.Map.Map2DControl;
                params.template = template;
                printTask.execute(params, function (evt) {
                    window.open(evt.url, "_blank");
                }, function (erro) { alert(erro); });
            });
    }
</script>

posted @ 2017-06-28 14:25  扰扰  阅读(637)  评论(0编辑  收藏  举报