source:
trunk/workshop-routing-foss4g/web/GeoExt/examples/print-extent.js
@
76
Revision 76, 1.6 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /** |
2 | * Copyright (c) 2008-2010 The Open Source Geospatial Foundation |
3 | * |
4 | * Published under the BSD license. |
5 | * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text |
6 | * of the license. |
7 | */ |
8 | |
9 | /** api: example[print-extent] |
10 | * Interactive Print Extent |
11 | * ------------------------ |
12 | * Change print scale, center and rotation with the PrintExtent plugin. |
13 | */ |
14 | |
15 | var mapPanel, printProvider; |
16 | |
17 | Ext.onReady(function() { |
18 | // The printProvider that connects us to the print service |
19 | printProvider = new GeoExt.data.PrintProvider({ |
20 | method: "GET", // "POST" recommended for production use |
21 | capabilities: printCapabilities, // from the info.json script in the html |
22 | customParams: { |
23 | mapTitle: "Printing Demo", |
24 | comment: "This is a map printed from GeoExt." |
25 | } |
26 | }); |
27 | |
28 | var printExtent = new GeoExt.plugins.PrintExtent({ |
29 | printProvider: printProvider |
30 | }); |
31 | |
32 | // The map we want to print, with the PrintExtent added as item. |
33 | mapPanel = new GeoExt.MapPanel({ |
34 | renderTo: "content", |
35 | width: 450, |
36 | height: 320, |
37 | layers: [new OpenLayers.Layer.WMS("Tasmania", "http://demo.opengeo.org/geoserver/wms", |
38 | {layers: "topp:tasmania_state_boundaries"}, {singleTile: true})], |
39 | center: [146.56, -41.56], |
40 | zoom: 6, |
41 | plugins: [printExtent], |
42 | bbar: [{ |
43 | text: "Create PDF", |
44 | handler: function() { |
45 | // the PrintExtent plugin is the mapPanel's 1st plugin |
46 | mapPanel.plugins[0].print(); |
47 | } |
48 | }] |
49 | }); |
50 | printExtent.addPage(); |
51 | }); |
Note: See TracBrowser
for help on using the repository browser.