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 GeoExt.data.PrintProvider({
method: "GET",
url: "/geoserver/pdf",
listeners: {
"loadcapabilities": function() {
var printPage = new GeoExt.data.PrintPage();
printPage.fit(mapPanel, true);
printProvider.print(mapPanel, printPage);
}
},
customParams: {
mapTitle: "LVR WebGIS",
comment: "created with GeoExt"
}
})
})],
bbar: [{
text: "Create PDF",
handler: function() {
printDialog.items.get(0).print();
}
}]
});
printDialog.show();
}
}]
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?