Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 ?

share|improve this question

2 Answers 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.

share|improve this answer
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

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

Did you tried with different browsers?

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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