aratcliffe / Leaflet.print

Plugin for printing a Leaflet map using either Mapfish or the GeoServer print module.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON Exception - Unable to print using Geoserver print plugin

kyiannis opened this issue · comments

Hi,
I was trying to print to pdf using POST method and Geoserver print plugin but geoserver logged the following error:
.....
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at character 0
at org.json.JSONTokener.syntaxError(JSONTokener.java:410)
at org.json.JSONObject.(JSONObject.java:179)
at org.json.JSONObject.(JSONObject.java:402)
at org.mapfish.print.MapPrinter.parseSpec(MapPrinter.java:154)
......

I modified the source code in leaflet.print-src.js. Added the following after line 138 (i.e. print function):
contentType: 'application/json; charset=UTF-8',
processData: false,
Now the plugin works as its supposed to work!!!
Yiannis

Thanks for your contribution Yiannis I've committed this today.