[Geoserver-users] Print Plugin - Getting Started

Dear list,

I try to get the GeoServer Print Plugin running. I installed it according to the instruction: http://docs.geoserver.org/stable/en/user/extensions/printing/index.html

The "config.yaml" got created (see below) and it is possible to open the "info.json": http://isi.zgis.at/geoserver/pdf/info.json

Now, I would like to print a "HelloWorld" PDF. I tried to do it with this URL (or see below for the formatted version):

http://isi.zgis.at/geoserver/pdf/print.pdf?spec=\{"layout":%20"A4%20portrait","srs":%20"EPSG:4326","units":%20"degrees","geodetic":%20false,"outputFilename":%20"political\-boundaries","outputFormat":%20"pdf","layers":%20\[\{"type":%20"WMS","layers":%20\["TOPO\-WMS"\],"baseURL":%20"ows\.terrestris\.de/osm/service?","format":%20"image/jpeg"\}\],%22pages%22:%20[{%22center%22:%20[6,%2045.5],%22scale%22:%20%221:4.000.000%22,%22dpi%22:%2075,%22geodetic%22:%20false,%22strictEpsg4326%22:%20false}],%22legends%22:%20[{%22classes%22:%20[{%22icons%22:%20[%22full%20url%20to%20the%20image%22],%22name%22:%20%22an%20icon%20name%22,%22iconBeforeName%22:%20true}],%22name%22:%20%22a%20class%20name%22}]}

But I receive an error 404: "Invalid character found in the request target."

Could you give me a hint what I do wrong?
Is the "spec" parameter formatted correctly in my URL?

Kind regards,
Jakob

Request URL for PDF:
---------------------------

http://isi.zgis.at/geoserver/pdf/print.pdf?spec=\{
"layout": "A4 portrait",
"srs": "EPSG:4326",
"units": "degrees",
"geodetic": false,
"outputFilename": "political-boundaries",
"outputFormat": "pdf",
"layers": [
{
"type": "WMS",
"layers": ["TOPO-WMS"],
"baseURL": "ows.terrestris.de/osm/service?",
"format": "image/jpeg"
}
],
"pages": [
{
"center": [6, 45.5],
"scale": "1:4.000.000",
"dpi": 75,
"geodetic": false,
"strictEpsg4326": false
}
],
"legends": [
{
"classes": [
{
"icons": [
"full url to the image"
],
"name": "an icon name",
"iconBeforeName": true
}
],
"name": "a class name"
}
]
}

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/img/geoserver-logo.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

Hi Jakob,
it looks like recent versions of Tomcat require encoding of brackets. Try this one:

http://isi.zgis.at/geoserver/pdf/print.pdf?spec=%7B%22layout%22%3A%20%22A4%20portrait%22%2C%22srs%22%3A%20%22EPSG%3A4326%22%2C%22units%22%3A%20%22degrees%22%2C%22geodetic%22%3A%20false%2C%22outputFilename%22%3A%20%22political-boundaries%22%2C%22outputFormat%22%3A%20%22pdf%22%2C%22layers%22%3A%20%5B%7B%22type%22%3A%20%22WMS%22%2C%22layers%22%3A%20%5B%22TOPO-WMS%22%5D%2C%22baseURL%22%3A%20%22ows.terrestris.de%2Fosm%2Fservice%22%2C%22format%22%3A%20%22image%2Fjpeg%22%7D%5D%2C%22pages%22%3A%20%5B%7B%22center%22%3A%20%5B6%2C%2045.5%5D%2C%22scale%22%3A%20%221%3A4.000.000%22%2C%22dpi%22%3A%2075%2C%22geodetic%22%3A%20false%2C%22strictEpsg4326%22%3A%20false%7D%5D%2C%22legends%22%3A%20%5B%7B%22classes%22%3A%20%5B%7B%22icons%22%3A%20%5B%22full%20url%20to%20the%20image%22%5D%2C%22name%22%3A%20%22an%20icon%20name%22%2C%22iconBeforeName%22%3A%20true%7D%5D%2C%22name%22%3A%20%22a%20class%20name%22%7D%5D%7D

Rispondi a tuttiRispondiInoltra

···

Regards,

Mauro Bartolomeoli

==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.

Dott. Mauro Bartolomeoli
@mauro_bart
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.