[OpenLayers-Users] printing...

John Cole john.cole at uai.com
Sat Mar 24 15:02:56 EDT 2007


Printing to a pdf via mapserver is ideal when you only need the map output,
but when dealing with the contents of a web based application, the map is
rarely the sole contents of the page.

In my case, I have additional information associated with the map that needs
to be included in the report, which rules out using mapserver's pdf output.
I'll also have to create a legend which isn't supported with a mapserver
pdf.

I tried my idea of having two maps and div tags, turning one off with the
screen stylesheet and vice versa with the print sytlesheet, but apparently
the OL map object overrides the display value of the div tag, turning both
on at the same time.

As another approach, I was thinking of just having a div tag and setting
it's background image property to the value of a WMS request pulled from one
of the layers.  I believe that I will have to have a print button in order
to have JS turn off the map visibility so that it will be replaced by the
div with the wms background when using the print stylesheet.  I'd love to
get this working just through the stylesheets, since then users could simply
use the browsers file->print rather than rely on a page element (I know I'll
get calls about file-print not working :-) )

Still open to suggestions though!

John 

-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com] 
Sent: Saturday, March 24, 2007 11:46 AM
To: John Cole
Cc: openlayers
Subject: Re: [OpenLayers-Users] printing...

On Sat, Mar 24, 2007 at 10:14:58AM -0600, John Cole wrote:
> What is the easiest way of getting OL to configure itself for printing?
The
> issue I have is that when printing with overlays and controls, the base
map
> gets covered and doesn't show (try a print preview on one of the example
> pages with multiple layers).

> So far, my only idea is to have two maps defined, one with a single layer
> that is only enabled in the print stylesheet while the other is disabled,
> and have some JS to keep the two in sync.  Any other suggestions?

I highly recommend not depending on browsers for printing.

Instead, I recommend using some other tool to render a PDF out of your
backend: MapServer, for example, has a PDF output. Using PDF output
(instead of browser-based printing) means that your renderer is in
control of styling of the map, and you don't have the issues with
overlays or anything else.

http://mumbai.freemap.in/ uses this technique.

That's always been my recommendation, and I'm sticking to it :) 

Regards,
-- 
Christopher Schmidt
MetaCarta

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/731 - Release Date: 3/23/2007
3:27 PM
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/731 - Release Date: 3/23/2007
3:27 PM
 
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.



More information about the Users mailing list