1

Software setup and information

I'm using GeoExplorer to access layers served by GeoServer (on my localhost) which in turn is linked to a PostGIS database (local again). I'm using GeoServer 2.5, so I downloaded the v2.5 print plugin and followed the instructions here.

Issue

When I click the print button, the print preview pops up and I can edit my printing options as expected. However when I try to Print, the software tries to "Export to PDF" but fails, producing an error box which states: "Communication Trouble: Status undefined"

Steps taken to resolve issue

I've attempted to play with the config.yaml file located in the GeoServer directory according to the MapFish documentation (http://www.mapfish.org/doc/print/configuration.html) but being new to all this, I haven't been able to make it work... At the minute I'm using the standard config.yaml file generated when I restarted GeoServer after installing the print plugin (pasted below)

config.yaml:

#===========================================================================
# allowed DPIs
#===========================================================================
dpis: [75, 150, 300]

#===========================================================================
# the allowed scales
#===========================================================================
scales:
  - 25000
  - 50000
  - 100000
  - 200000
  - 500000
  - 1000000
  - 2000000
  - 4000000

#===========================================================================
# the list of allowed hosts
#===========================================================================
hosts:
  - !localMatch
    dummy: true
  - !ipMatch
    ip: www.camptocamp.org
  - !dnsMatch
    host: demo.opengeo.org
    port: 80
  - !dnsMatch
    host: terraservice.net
    port: 80
  - !dnsMatch
    host: sigma.openplans.org
  - !dnsMatch
    host: demo.mapfish.org

layouts:
  Legal:
    mainPage:
      pageSize: LEGAL
      items:
        - !map
          spacingAfter: 30
          width: 440
          height: 483
  #===========================================================================
  A4 portrait:
  #===========================================================================
    metaData:
#      title: '${mapTitle}'
      author: 'MapFish print module'
      subject: 'Simple layout'
      keywords: 'map,print'
      creator: 'MapFish'

    titlePage:
      pageSize: A4
      items:
        - !text
          spacingAfter: 150
        - !text
          font: Helvetica
          fontSize: 40
          spacingAfter: 100
          align: center
          text: '${layout}'
        - !image
          maxWidth: 160
          maxHeight: 160
          spacingAfter: 100
          align: center
          url: http://trac.mapfish.org/trac/mapfish/attachment/ticket/3/logo_v8_sphere.svg?format=raw

      footer: &commonFooter
        height: 30
        items:
          - !columns
            config:
              cells:
                - paddingBottom: 5   
            items:
              - !text
                backgroundColor: #FF0000
                align: left
            text: a red box
              - !text
                align: right
                text: 'Page ${pageNum}'
              - !image
                align: center
                maxWidth: 100
                maxHeight: 30
                spacingAfter: 200
                url: 'http://geoserver.org/download/attachments/10158143/pbGS-Bttn228x68.png'

    #-------------------------------------------------------------------------
    mainPage:
      pageSize: A4
      rotation: true
#      header:
#        height: 50
#        items:
#          - !text
#            font: Helvetica
#            fontSize: 30
#            align: right
#            text: '${layout}'
      items:
        - !text
          text: '${mapTitle}'
          fontSize: 30
          spacingAfter: 30
        - !map
          spacingAfter: 30
          width: 440
          height: 483
        - !columns
          # columns can have an absolute position. In that case, they need the 3 following fields:
          absoluteX: 410
          absoluteY: 310
          width: 100
          items:
            - !scalebar
              type: bar
              maxSize: 100
              barBgColor: white
              fontSize: 8
              align: right
        - !text
          text: '${comment}'
          spacingAfter: 30
        - !attributes
          source: data
          spacingAfter: 30
          columnDefs:
            id:
              columnWeight: 2
              header: !text
                text: ID
                backgroundColor: #A0A0A0
              cell: !text
                text: '${id}'
            name:
              columnWeight: 5
              header: !text
                text: Name
                backgroundColor: #A0A0A0
              cell: !columns
                config:
                  cells:
                    - backgroundColor: '${nameBackgroundColor}'
                      borderWidth: 1
                      borderColor: '${nameBorderColor}'
                items:
                  - !text
                    text: '${name}'
            icon:
              columnWeight: 2
              header: !text
                text: Symbol
                backgroundColor: #A0A0A0
              cell: !image
                align: center
                maxWidth: 15
                maxHeight: 15
                url: 'http://www.mapfish.org/svn/mapfish/trunk/MapFish/client/mfbase/mapfish/img/${icon}.png'
        - !text
          font: Helvetica
          fontSize: 9
          align: right
          text: '1:${scale} ${now MM.dd.yyyy}'
      footer: *commonFooter

Anyone have ideas how I can get my maps to export to pdf from GeoExplorer?

1

This configuration in my case, work well:

dpis: [75, 150, 300]

scales:
    - 524288000
    - 262144000
    - 131072000
    - 65536000
    - 32768000
    - 16384000
    - 8192000
    - 4096000
    - 2048000
    - 1024000
    - 512000
    - 256000
    - 128000
    - 64000
    - 32000
    - 16000
    - 8000
    - 4000
    - 2000
    - 1000

hosts:
    - !localMatch
         dummy: true
     - !ipMatch
         ip: 0.0.0.0
         mask: 0.0.0.0

layouts:

    A4:
    metaData: &commonMetaData
        title: "${mapTitle}"
        author: "xxxx"
        subject: "yyyyy"
        keywords: "map,print"
        creator: "OpenGeo Suite"
        mainPage:
        pageSize: A4
        rotation: true
        items:
            - !text
                text: "${mapTitle}"
                fontSize: 30
                spacingAfter: 30
                align: center
            - !map
                spacingAfter: 10
                width: 440
                height: 600
            - !scalebar
                type: bar
                maxSize: 100
                barBgColor: white
                fontSize: 8
                align: right
                spacingAfter: 10
            - !text
                text: "${comment}"

Legal:
    metaData: *commonMetaData
    mainPage:
        pageSize: LEGAL
        rotation: true
        items:
            - !text
                text: "${mapTitle}"
                fontSize: 30
                spacingAfter: 30
                align: center
            - !map
        spacingAfter: 10
                width: 440
                height: 650
            - !scalebar
                type: bar
                maxSize: 100
                barBgColor: white
                fontSize: 8
                align: right
                spacingAfter: 10
            - !text
                text: "${comment}"

Letter:
    metaData: *commonMetaData
    mainPage:
        pageSize: LETTER
        rotation: true
        items:
            - !text
                text: "${mapTitle}"
                fontSize: 30
                spacingAfter: 30
                align: center
            - !map
                spacingAfter: 10
                width: 440
                height: 550
            - !scalebar
                type: bar
                maxSize: 100
                barBgColor: white
                fontSize: 8
                align: right
                spacingAfter: 10
            - !text
                text: "${comment}"

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.