[OpenLayers-Users] Printing with IE7

teknocreator teknocreator at gmail.com
Tue Jul 23 05:03:48 PDT 2013


You might be able to open a separate window, build a page via javascript,
insert the map element there, and then print the window.  Here's what I've
come up with that seems to work in IE8 but note that there's some ExtJS
calls and styling here as that's the GUI framework I'm using for our page as
well as use of a table so our label and info elements/images line up
correctly:



The "extwin.document.close()" is important for one of the browsers ( IE I
think) as the print dialog won't appear without it (called by .print()). 
So, essentially:

- get the map element's width and height
- create and open a new browser window using that width and height values
(adding a bit of padding)
- create a page dynamically using the window.document.write() function,
writing the map element into the body.
- close the document when done writing
- calling the new window's print dialog.   

You can see if this will work or not for IE7 by going to
http://preview.weather.gov/graphical and clicking on the "Print Map" button. 
Seems to work for IE8 though there are other problems in IE8 that I don't
think we're going to solve or work on.

Hope this helps...finding a printing solution was definitely an issue that
took some time to solve.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Printing-with-IE7-tp5065444p5068208.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list