A map panel that controls scale and center of a print page. Based on the current view (i.e. layers and extent) of a source map, this panel will be sized according to the aspect ratio of the print page. As the user zooms and pans in the GeoExt.PrintMapPanel, the print page will update its scale and center accordingly. If the scale on the print page changes (e.g. by setting it using a combo box with a GeoExt.plugins.PrintPageField), the extent of the GeoExt.PrintMapPanel will be updated to match the page bounds.
Note
The zoom, center and extent config options will have no affect, as they will be determined by the sourceMap.
A map with a “Print...” button. If clicked, a dialog containing a PrintMapPanel will open, with a “Create PDF” button.
var mapPanel = new GeoExt.MapPanel({
renderTo: "map",
layers: [new OpenLayers.Layer.WMS("Tasmania State Boundaries",
"http://demo.opengeo.org/geoserver/wms",
{layers: "topp:tasmania_state_boundaries"}, {singleTile: true})],
center: [146.56, -41.56],
zoom: 6,
bbar: [{
text: "Print...",
handler: function() {
var printDialog = new Ext.Window({
autoHeight: true,
width: 350,
items: [new GeoExt.PrintMapPanel({
sourceMap: mapPanel,
printProvider: {
capabilities: printCapabilities
}
})],
bbar: [{
text: "Create PDF",
handler: function() {
printDialog.items.get(0).print();
}
}]
});
printDialog.show();
}
}]
});
Configuration properties in addition to those listed for Ext.Panel.
GeoExt.data.PrintProvider or Object PrintProvider to use for printing. If an Object is provided, a new PrintProvider will be created and configured with the object.
Note
The PrintMapPanel requires the printProvider’s capabilities to be available upon initialization. This means that a PrintMapPanel configured with an Object as printProvider will only work when capabilities is provided in the printProvider’s configuration object. If printProvider is provided as an instance of GeoExt.data.PrintProvider, the capabilities must be loaded before PrintMapPanel initialization.
Public properties in addition to those listed for Ext.Panel.
Public methods in addition to those listed for Ext.Panel.
Parameter: | options – Object options for the GeoExt.data.PrintProvider :: print method. |
---|
Convenience method for printing the map, without the need to interact with the printProvider and printPage.