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.

I've installed GeoServer's map printing module. I've tested that it works by following the instructions here. Now, I'm using GeoExt.PrintMapPanel, and my code is as shown below:

var mapPanel = new GeoExt.MapPanel({
        renderTo: "mappanel",
        map: map,
        layers: [wms, gLayer, vector],
        center: new OpenLayers.LonLat(21.0936111111, 7.18805555556),
        zoom: 2.5,
        tbar: toolbarItems,
        bbar: [{
            icon: "img/printer.png",
            tooltip: "Print map",
            handler: function() {
                var printDialog = new Ext.Window({
                    autoHeight: true,
                    width: 350,
                    items: [new GeoExt.PrintMapPanel({
                        sourceMap: mapPanel,
                        printProvider: {
                            capabilities: printCapabilities
                        }
                    })],
                    bbar: [{
                        text: "Create PDF",
                        handler: function() {
                            printDialog.items.get(0).print();
                        }
                    }]
                });
                printDialog.show();
            }
        }]
    });

where printCapabilities is http://localhost:8081/geoserver/pdf/info.json?var=printCapabilities, my local installation. I've written this by following the example here.

However, when I try printing, the following error is shown in GeoServer log: org.mapfish.print.JsonMissingException: attribute [spec.pages[0].mapTitle] missing. Any idea on how I can solve this will be appreciated.

share|improve this question
    
You can answer your own question and accept it so this question is marked as answered. Alternatively, I can close it for you. –  underdark Aug 22 '12 at 13:22
    
Thanks for the pointer, @underdark. –  okello Aug 22 '12 at 13:36
add comment

1 Answer 1

up vote 1 down vote accepted

I sorted this out by adjusting printProvider to:

var printProvider = new GeoExt.data.PrintProvider({
        url: "http://localhost:8081/geoserver/pdf",
        method: "GET", // "POST" recommended for production use
        capabilities: printCapabilities, // from the info.json script in the html
        customParams: {
            mapTitle: "Printing Demo",
            comment: "This is a simple map printed from GeoExt."
        }
    });
share|improve this answer
add comment

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.