Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What i've got is a map served by the tilecache and shown by openlayers and geoext.

Now i need to print this map, so what i've done is:

made a button which creates ( a new window with my map in it and window.print() on body onload.

This works well exept that i'm getting a second blank page. So the question is: how (and where) do i set map size and proportions to have it printed correctly?

map is created this way:

map = new OpenLayers.Map("map", {
    maxExtent : new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
    maxResolution : 156543.03125 / 64,
    numZoomLevels : 11,
    units : 'm',
    projection : "EPSG:900913",
    displayProjection : new OpenLayers.Projection("EPSG:4326"),
share|improve this question

i think you can achieve this with some css bindings which is not a gis solution. in css there are lots of css media types and one of these is print element. you can add this to your index page with this way:

<link rel="stylesheet" type="text/css" media="print" href="print.css">

and with some css code may help you.

body {
    background: white;
        size: A4 landscape;

#menu {
    display: none;

        left: 0;
        top: 0;
    width: 500px;
        height: 500px;
        display: block;
        visiblity: visible;
* {
    overflow: visible !important;
        position: relative;

i hope it helps you.

share|improve this answer

Your Answer


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.