Class: module:Service

ngeo.print.module:Service.ngeo.print.module:Service

new module:Service(url, $http, ngeoLayerHelper)

Provides a function to create ngeo.print.Service objects used to interact with MapFish Print v3 services.

ngeo.print.Service objects expose the following methods:

  • createSpec: create a report specification object
  • createReport: send a create report request
  • getStatus: get the status of a report
  • getReportUrl: get the URL of a report
  • getCapabilities: get the capabilities of the server
let printBaseUrl = 'http://example.com/print';
let print = new ngeo.print.Service(printBaseUrl);

let scale = 5000;
let dpi = 72;
let layout = 'A4 portrait';
let format = 'pdf';
let reportSpec = print.createSpec(map, scale, dpi, layout, format, {
  'title': 'A title for my report',
  'rotation': 45 // degree
});

See our live example: ../examples/mapfishprint.html

TODO and limitations:

  • createSpec should also accept a bbox instead of a center and a scale.
  • Add support for ol.style.RegularShape. MapFish Print supports symbols like crosses, stars and squares, so printing regular shapes should be possible.
  • ol.style.Icon may use a sprite image, and offsets to define to rectangle to use within the sprite. This type of icons won't be printed correctly as MapFish Print does not support sprite icons.
Parameters:
Name Type Description
url string

URL to MapFish print web service.

$http angular.$http

Angular $http service.

ngeoLayerHelper ngeo.map.LayerHelper

Ngeo Layer Helper service.