1

I've been bugging people here for two weeks now to no avail.

I have a project linking maps of a local GeoServer service, what I want is that when I press a button a PDF is downloaded of whatever is on the map. Quite simple, but I haven't been able to get it to work or get any help online.

This is my code

https://jsfiddle.net/dw8kb737/

This is what the HTML displays, and what the PDF should look like.

https://i.imgur.com/6lV8eRU.png

Looking at examples from all these sources

Export PDF from OpenLayers map with jsPDF Export PDF from OpenLayers map with jsPDF https://stackoverflow.com/questions/25698741/download-html-div-into-pdf-using-jspdf https://openlayers.org/en/latest/examples/export-pdf.html https://gist.github.com/ka7eh/88761650efd3425080035e8535230d15 https://github.com/MrRio/jsPDF/blob/master/examples/basic.html https://github.com/mpetroff/print-maps https://jsfiddle.net/crabbly/kL68ey5z/ http://jsfiddle.net/canvasjs/cm1qyk2L/

Did not yield any results whatsoever with me.

I've been working on this for days, why is it not working, what am I missing?

Obviously the code there doesn't work as it doesn't even have a button as I was trying a lot of different things.

  • If GeoServer is providing all the layers then one way would be to configure GeoServer to provide application/pdf as an output format and then make a single GetMap request for the open layers at the extent, etc. Otherwise (GeoServer is not providing all layers) this doesn't sound a GeoServer server issue. – nmtoken Dec 23 '17 at 16:27
  • You need to enable CORS on Geoserver side. Your wms images comming out are not CORS enabled so you have a security issue. – pavlos Dec 27 '17 at 10:00

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.