OpenLayers print map

iGriffer picture iGriffer · Sep 27, 2012 · Viewed 7.3k times · Source

How can I print a map from the OpenLayers? I want to add print button in my OpenLayers page =) I have MapFish extension for my geoserver, but don`t know how to make request to it. Any other ideas are welcome) Help please.

Answer

user1693904 picture user1693904 · Nov 9, 2012

I had a similar problem using a reverse proxy, because I discovered the answer from info.json contais local ip reference instead of the public url

to solve brutally i replaced the ip referenze with the public url in the ajax request (see the following code. I hope it can be usefull for others...

this.capabilities.createURL = this.capabilities.createURL.replaceAll("192.168.0.0:8080", "mypublicurl");
this.capabilities.printURL= this.capabilities.printURL.replaceAll("192.168.0.0:8080", "mypublicurl");


Ext.Ajax.request({
    url:this.capabilities.createURL,
    jsonData:jsonData,
    success:function(response){
        response.responseText = response.responseText.replaceAll("192.168.0.0:8080", "mypublicurl");
        window.open(Ext.decode(response.responseText).getURL);
  }
});