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

I´m trying to add a print function to my GeoExt MapPanel, using the following code:

bbar: ["->", {
                    text: "Print...",
                    handler: function() { 
                        var printDialog = new Ext.Window({
                                items: [new GeoExt.PrintMapPanel({
                                    sourceMap: mapPanel,
                                    printProvider: new{
                                        method: "GET", 
                                        url: "/geoserver/pdf", 

                                        listeners: {
                                        "loadcapabilities": function() {
                                        var printPage = new;
                                  , true);
                                            printProvider.print(mapPanel, printPage);
                                            customParams: {
                                                mapTitle: "LVR WebGIS",
                                                comment: "created with GeoExt"
                                bbar: [{
                                    text: "Create PDF",
                                    handler: function() {

Using this code, I get the firebug error message

this.printProvider.layout is null

in line 240 of the PrintMapPanel.js

239  adjustSize: function(width, height) {
240  var printSize = this.printProvider.layout.get("size");
241  var ratio = printSize.width / printSize.height; 

when trying to print the MapPanel. Do I have to add a size/layout definition somewhere in the code or in the config.yaml of the print provider?

Any help is appreciated!



share|improve this question
up vote 5 down vote accepted

The map definitions should be in the YAML file. These are then accessed through the print web service via the info.json page.

For testing you can always hardcode these parameters by creating a JSON object:

var printCapabilities = {
            "name":"A4 portrait",

You can try this with the GeoExt example at Replace the printCapabilities with a hard-coded JSON object like above. Once this is working then get the JSON dynamically from the web service.

// The printProvider that connects us to the print service
var printProvider = new{
    method: "GET", // "POST" recommended for production use
    capabilities: printCapabilities // from the info.json script in the html
// Our print page. Tells the PrintProvider about the scale and center of
// our page.
printPage = new{
    printProvider: printProvider,
    customParams: {
        mapTitle: "Printing Demo",
        comment: "This is a simple map printed from GeoExt."
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.