[OpenLayers-Users] Print and Save Maps images

Stephen Woodbridge woodbri at swoodbridge.com
Thu Aug 23 10:04:57 EDT 2007


There are no good solutions to this. Adding a button to the tool bar is 
a no brainer, the problem is that you are very limited in what you can 
do in javascript to solve the problems that are basically the browsers 
can not print the composited screen presentations. There are issue with 
how the browsers deal with and print transparent images. There is 
nothing preventing you from having a button that would change the screen 
layout to one that is more printer friending in javascript. But the 
actual printing would still be limited to what the browser can do.

The idea behind having it done on the server is that the server could 
composite the various images into a single image that would be easier to 
print, but this has the problem that you point out that the server may 
not have access to all the images needed to make the composite. This is 
especially true for google tiles.

Saving is a whole other problem with similar issues. There is no way 
that I know of to composite multiple images used in the OpenLayers 
layers into a single image if that is what you want. Javascript does not 
have the tools to do the image processing and javascript can write the 
results to disk. You might be able to open a new window with the image 
you want to save if you could build it and maybe have the browser save 
that, but building the image in the browser in javascript is the problem.

So more problems than solutions, but identifying the problems is the 
first step to over coming them :)

-Steve W

Chris Hardin wrote:
> How would that work? The user might have several overlays and other
> options and you'd have to build that representation from the map
> server as well. It would seem that it would be simpler just to add a
> print icon to the map window that would print the map window as is and
> a save button to save it as an image, of course I have no clue how to
> do that part without the use of some browser plugin like the acrobat
> plugin.
> The printing and saving could be part of the Editing toolbar and it
> would need to be done on the client side with little server
> interaction since the state of the map is not known from the server
> side.
> 
> Chris
> 
> 
> 
> On 8/23/07, el* <eleanor at rhcda.com> wrote:
>> I have been struggling a lot with printing (with or without legends, etc),
>> so, although I am definitely not an OpenLayers expert, I expect I know the
>> answer to your question.
>>
>> Basically, to print the map you see on the screen, you need to gather the
>> bounds of the map you are looking at (map.getextent), gather the information
>> about which layers are turned on (map.layers.getvisibility), and then pass a
>> new request to your server (geoserver, mapserver) asking for a PDF or jpeg
>> or whatever.
>>
>> --Eleanor
>>
>>
>> Chris Hardin wrote:
>>> Is there a tool that will allow me to print and save the image in the
>>> map window?? Is something built into Open Layers for this or is there
>>> a third party solution?
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>
>>>
>> --
>> View this message in context: http://www.nabble.com/Print-and-Save-Maps-images-tf4313948.html#a12293755
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
> 
> 




More information about the Users mailing list