Provides an interface to a Mapfish or GeoServer print module. For printing, one or more instances of GeoExt.data.PrintPage are also required to tell the PrintProvider about the scale and extent (and optionally rotation) of the page(s) we want to print.
Minimal code to print as much of the current map extent as possible as soon as the print service capabilities are loaded, using the first layout reported by the print service:
var mapPanel = new GeoExt.MapPanel({
renderTo: "mappanel",
layers: [new OpenLayers.Layer.WMS("wms", "/geoserver/wms",
{layers: "topp:tasmania_state_boundaries"})],
center: [146.56, -41.56],
zoom: 7
});
var printProvider = new GeoExt.data.PrintProvider({
url: "/geoserver/pdf",
listeners: {
"loadcapabilities": function() {
var printPage = new GeoExt.data.PrintPage({
printProvider: printProvider
});
printPage.fit(mapPanel, true);
printProvider.print(mapPanel, printPage);
}
}
});
Configuration properties in addition to those listed for Ext.util.Observable.
Public properties in addition to those listed for Ext.util.Observable.
Ext.data.JsonStore read-only. A store representing the dpis available.
Fields of records in this store:
Ext.data.JsonStore read-only. A store representing the layouts available.
Fields of records in this store:
Ext.data.JsonStore read-only. A store representing the scales available.
Fields of records in this store:
Public methods in addition to those listed for Ext.util.Observable.
Parameters: |
|
---|
Sends the print command to the print service and opens a new window with the resulting PDF.
Valid properties for the options argument:
legend - GeoExt.LegendPanel If provided, the legend will be added to the print document. For the printed result to look like the LegendPanel, the following !legends block should be included in the items of your page layout in the print module’s configuration file:
- !legends maxIconWidth: 0 maxIconHeight: 0 classIndentation: 0 layerSpace: 5 layerFontSize: 10overview - OpenLayers.Control.OverviewMap If provided, the layers for the overview map in the printout will be taken from the OverviewMap control. If not provided, the print service will use the main map’s layers for the overview map. Applies only for layouts configured to print an overview map.
Parameter: | dpi – Ext.data.Record the dpi record. |
---|
Sets the dpi for this printProvider.
Parameter: | layout – Ext.data.Record the record of the layout. |
---|
Sets the layout for this printProvider.
Events in addition to those listed for Ext.util.Observable.
Triggered before a layer is encoded. This can be used to exclude layers from the printing, by having the listener return false.
Listener arguments:
Triggered when the print method is called.
Listener arguments:
Triggered when the dpi value is changed.
Listener arguments:
Triggered when a layer is encoded. This can be used to modify the encoded low-level layer object that will be sent to the print service.
Listener arguments:
Triggered when the layout is changed.
Listener arguments:
Triggered when the capabilities have finished loading. This event will only fire when capabilities is not configured.
Listener arguments:
Triggered when the print document is opened.
Listener arguments:
Triggered when using the POST method, when the print backend returns an exception.
Listener arguments: