I recently added the print function to my GeoExt web application, using
<script type="text/javascript"src="http://localhost:8080/geoserver/pdf/info.json?var=printCapabilities"></script>
to define the printCapabilities variable,
var printProvider = new GeoExt.data.PrintProvider({
method: "GET",
url: "localhost/geoserver/pdf",
capabilities: printCapabilities
});
for the print provider and within the mapPanel
bbar: ["->", {
text: "Print...",
handler: function() {
var printDialog = new Ext.Window({
items: [new GeoExt.PrintMapPanel({
sourceMap: mapPanel,
printProvider: printProvider,
listeners: {
"loadcapabilities": function() {
var printPage = new GeoExt.data.PrintPage({
printProvider: printProvider,
customParams: {
mapTitle: "LVR WebGIS",
comment: "created with GeoExt"
}
});
printPage.fit(mapPanel, true);
printProvider.print(mapPanel, printPage);
}
},
})
],
bbar: [{
text: "Create PDF",
handler: function() {
printDialog.items.get(0).print();
}
}]
});
printDialog.show();
}
}],
to add the function to my mapPanel. Regarding this, I have two issues to be solved:
1.) the printPage popping up does not contain anything but the button saying "Create PDF". There should be a preview of the map to print, right?
2.) when some WFS vector features are displayed in the map, the print function does not work properly anymore. It opens a new tab in my browser but does not create the PDF. Instead, the new tab is left about:blank.
What am I doing wrong here? Is the information I provided enough for you guys to help me solve the problem? Thanks a lot for your help!