1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
| define(["dojo/_base/declare", "esri/config", "esri/arcgis/utils", "dojo/_base/array", "esri/dijit/Print", "esri/tasks/PrintTask", "esri/tasks/PrintTemplate", "esri/tasks/PrintParameters", "dojo/dom"], function (declare, esriConfig, arcgisUtils, arrayUtils, Print, PrintTask, PrintTemplate, PrintParameters, dom) {
| var clazz, tb;
| clazz = declare("Print", null, {
| constructor: function () {},
| printtools: function () {
| var layouts = [{
| name: "A4 Landscape",
| label: "Landscape (PDF)",
| format: "pdf",
| options: {
| legendLayers: [],
| scalebarUnit: "Miles",
| titleText: "测试内容"
| }
| }, {
| name: "Letter ANSI A Portrait",
| label: "Portrait (Image)",
| format: "jpg",
| options: {
| legendLayers: [],
| scalebarUnit: "Miles",
| titleText: "测试内容"
| }
| }];
| var printMap = new PrintTask(config_services.GPServer_Export);
| var template = new PrintTemplate();
| var params = new PrintParameters();
| printMap.outSpatialReference = map.SpatialReference;
| template.exportOptions = {
| dpi: 150
| };
| template.format = $('#printType').val();
| template.layout = $('#pageSetting').val();
| params.map = map;
| params.template = template;
| printMap.execute(params, function (result) {
| if (result != null) {
| window.open(result.url)
| }
| })
| },
| });
| clazz.getInstance = function () {
| if (instance === null) {
| instance = new clazz()
| }
| return instance
| };
| return clazz
| });
|
|