Class to communicate with the print module.
This class will automatically pick the layers from the OL map and create the configuration structure accordingly.
As we often want a sligtly different styling or minScale/maxScale, an override functionallity is provided that allows to override the OL layers’ configuration, this can be used as well if a layer’s URL points to a TileCache service to allow the print module to access the WMS service directly.
{ 'layerName1': { visibility: false }, 'layerName2': { visibility: false, 300: { visibility: true } } }
In this example, the OL layer named “layerName1” is never printed. The OL layer “layerName2” is visible only when printed at 300DPI.
mapfish. PrintProtocol | Class to communicate with the print module. |
Properties | |
config | {String} the configuration as returned by the MapPrinterServlet. |
spec | {Object} The complete spec to send to the servlet. |
params | {Object} Additional params to send in the print service Ajax calls. |
Constructor | |
OpenLayers. Layer | |
Functions | |
getAllInOneUrl | Creates the URL string for generating a PDF using the print module. |
createPDF | Uses AJAX to create the PDF on the server and then gets it from the server. |
getConfiguration | Does an AJAX call to get the print configuration from the server. |
map | {OpenLayers.Map} The OL MAP. |
config | {Object} the configuration as returned by the MapPrinterServlet. |
overrides | {Object} the map that specify the print module overrides for each layers. |
dpi | {Integer} the DPI resolution |
params | {Object} additional params to send in the Ajax calls |
createPDF: function( success, popup, failure, context )
Uses AJAX to create the PDF on the server and then gets it from the server. If it doesn’t work (different URL and OpenLayers.ProxyHost not set), try the GET direct method.
success | {Function} The function to call in case of success. |
popup | {Function} The function to call in case of success, but when unable to load automatically the document. |
failure | {Function} The function to call in case of failure. Gets the request object in parameter. If getURL is defined, the popup where blocked and the PDF can still be recovered using this URL. |
context | {Object} The context to use to call the success of failure method. |
mapfish.PrintProtocol.getConfiguration = function( url, success, failure, context, params )
Does an AJAX call to get the print configuration from the server.
url | {String} the URL to access .../config.json |
success | {Function} the function that will be called with the configuration object when/if its received. |
failure | {Function} the function that is called in case of error. |
context | {Object} The context to use when calling the callbacks. |
params | {Object} additional params to send in the Ajax calls |
Creates the URL string for generating a PDF using the print module.
getAllInOneUrl: function()
Uses AJAX to create the PDF on the server and then gets it from the server.
createPDF: function( success, popup, failure, context )
Does an AJAX call to get the print configuration from the server.
mapfish.PrintProtocol.getConfiguration = function( url, success, failure, context, params )