1

I use Geoserver, Openlayers, Extjs and GeoExt to build an app.

I am trying to get vector layer on Google map printed with pop up a Print dialog, I tried :

var targetElement = Ext.getCmp('mapPanel');
                    var myWindow = window.open('', '', 'width=600,height=500');
                    myWindow.document.write('<html><head>');
                    myWindow.document.write('<title>' + 'Title' + '</title>');
                    myWindow.document.write('</head><body>');
                    myWindow.document.write(targetElement.body.dom.innerHTML);
                    myWindow.document.write('</body></html>');
                    myWindow.print();

it works fine except that Vector layer were not printed. I got Google map only. How I can do that ?

2

Is your vector layer in the Google Mercator projection (900913)? I believe your vector layer has to be in the same coordinate system as the Google Map tiles.

  • 1
    Yes I use the new Google projection and transform vector layer using: .transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:3857")) ... it displayed on the map but when I print it on real paper I got Google layer only. – Shadin Sep 18 '12 at 8:56
0

Some browsers will require you enable the “Print background colors and images” in order to print properly.

Did you tried with different browsers?

  • Thanks! it works in Firefox but not in Chrome. How I could fix it ? – Shadin Sep 18 '12 at 10:49
  • Also, the popup of vector feature was not printed! though all features printed just fine. – Shadin Sep 18 '12 at 10:51
  • Maybe this can help: stackoverflow.com/questions/9984824/… and you can also try to play with Google Chrome hidden options - at the adress bar just type chrome://about/ and play with it (start with chrome://flags/) – jcoelho Sep 19 '12 at 14:50
  • And plus this one: stackoverflow.com/questions/2392366/… But may be not possible to do it on Google Chrome... – jcoelho Sep 19 '12 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.