[OpenLayers-Users] Print map to pdf
Greg Allensworth
gregor at greeninfo.org
Thu Oct 25 09:20:53 PDT 2012
Purely on the client side, no, you can't print it. You will need some
server-side components.
One of our favorite approaches, is wkhtmltoimg and wkhtmltopdf
If you're interested, I just presented about this last week and the
materials are online:
http://www.parkinfo.org/gregor/NACIS2012/
These are command-line tools, using the WebKit engine to read a
HTML/CSS/JavaScript document, and generate a static image or a PDF.
Basically, you write your OpenLayers code, save the resulting
HTML/JS/CSS to disk, then crunch it to generate a final PDF.
A down side here, is that the resulting map is browser quality. We've
also had issues with the images resulting from JavaScript (e.g. the map
itself) being of poor quality, so we often use a two-step process:
wkhtmltoimg one one HTML page to save the map as an image, then
wkhtmltopdf to embed that image into a final PDF.
--
Greg Allensworth, Web GIS Developer
BS A+ Network+ Security+ Linux+ Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510 San Francisco CA 94104
PH: 415-979-0343 x302 FX: 415-979-0371 email: gregor at greeninfo.org
Web: www.GreenInfo.org www.MapsPortal.org
Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org
More information about the Users
mailing list