2

I've been going through this article, this Mapfish documentation and this Geoserver doc (apparently out of date) in attempt to get the Mapfish3 print service going in order to eventually use in my web app (using GeoExt3 and Openlayers 4, but this probably is extraneous in terms of this post).

I was hopeful when I saw this question, but it is for Mapfish2, which is quite different from Mapfish3. Also note that I am not trying to use the Geoserver print plugin mentioned in the Geoserver doc, but I referred to it as it is how I deduced to copy the jrxml and yaml files (potentially incorrect).

I have done the following:

  • Deployed the test print module to my tomcat web server
  • Created a simple jrxml file and a simple config.yaml file (copied into the GeoServer2.15.1/data_dir/printing folder (contents reflect the mentioned article's models exactly except they point to a wms on my hosted geoserver),
  • Written up specs to be pasted into the test print input window

Upon pressing Create and Get Print a pdf is generated. However, it is a blank white page with the title "Map" on it, which does not reflect any of the three files I've established (e.g. default title should be "Pays" and map is not displayed). I assume I have not put these files in the correct location, or am missing something else.

According to this page of the Mapfish documentation under reportTemplate:

The path to the report template used to render each row of the data. This is only required if a subreport needs to be compiled and is referenced in the containing report's detail section. The path should be relative to the configuration directory.

Is the configuration directory the geoserver/data_dir as I've assumed?

My config.yaml:

throwErrorOnExtraParameters: true
transparentTileErrorColor: "rgba(78, 78, 255, 125)"
opaqueTileErrorColor: "rgba(255, 155, 155, 0)"

templates:
  A4 landscape: !templates
    reportTemplate: Map_A4_Landscape.jrxml
    attributes:
      title: !string
        default: "Pays"
      map: !Map
        maxDpi: 400
        width: 780
        height: 330
      processors:
      - !reportBuilder
        directory: '.'
      - !createMap

The specs copied into the test app:

{
  "layout": "A4 landscape",
  "outputFormat": "pdf",
  "attributes": {
    "map": {
      "projection": "EPSG: 3297",
      "dpi": 72,
      "rotation":0,
      "center": [-149.3, -17.7],
      "scale": 130000000,
      "layers": [
        {
          "baseURL": "http://xxx.xx.xxx:8080/geoserver/test/wms",
          "opacity": 1,
          "type": "wms",
          "layers": ["workspace:layername"],
          "imageFormat": "image/png",
          "styles": ["stylename"],
          "customParams": {
            "TRANSPARENT": "true"
          }
        }
      ]
    }
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.