Hi, I have installed Geoserver Printing Module extension successfully and trying to print a map using the following specifications using ajax
var specs = {
"units": "degrees",
"srs": "EPSG:4326",
"layout": "A4 portrait",
"dpi": 75,
"layers": [
{
"baseURL": "http://localhost:8080/geoserver/wms
",
"opacity": 1,
"singleTile": false,
"type": "WMS",
"layers": [
"topp:states"
],
"format": "image/jpeg",
"styles": [
""
],
"customParams": {
}
}
],
"pages": [
{
"center": [
-105.03125, //long
40.87890625 //lat
],
"scale": 4000000,
"rotation": "0",
"mapTitle": "USA Population",
"comment": "A custom comment"
}
]
};
$.ajax(
{
url: '
http://localhost:8080/geoserver/pdf/print.pdf',
data: 'spec=' + JSON.stringify(specs),
type: 'POST',
xhrFields: {
responseType: 'blob'
},
success: function (data)
{
var blob = new Blob([data]);
var link =
document.getElementById('my-pdf');
link.href =
window.URL.createObjectURL(blob);
link.download = "Pdf.pdf";
alert("Success");
},
error: function ()
{
alert("Failure");
}
});
}
What I'm getting as output is the attached pdf.
And I couldn't able to customize the layout.
Please guide me what I'm missing.
Thanks
- Polen
Pdf (2).pdf
Description: Adobe PDF document
_______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
