Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 (window.open()) 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

1 Answer 1

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;
    }

#map-panel{
        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

 
discard

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.