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() {

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!

  • Did you get anywhere with this? We are having a similar problem. – user7231 Apr 30 '12 at 11:39

Shouldn't the print provider set up refer to localhost:8080 instead of localhost/ ? if they really are on different ports then you probably need a proxy to handle the same origin requirements.

| improve this answer | |
  • Well, it seem as this would help in one way: the new tab opening is not blank but is leading to this terribly long URL: http://localhost:8080/geoserver/pdf/print.pdf?spec=%7B%22units%22%3A%22degrees%22%2C%22srs%22%3A%22EPSG%3A4326%22%2C%22layout%22%3A%22A4%22%2C%22dpi%22%3A380%2C%22layers%22%3A%5B%7B%22baseURL%22%3A%22http%3A%2F%2Fwww.wms.nrw.de%2Fgeobasis%2FDOP_JPG%3F%22%2C%22opacity%22%3A1%2C%22singleTile%22%3Afalse%2C%22type%22%3A%22WMS and so on, it basically lists each feature in the map with it´s parameters. Something loads but stops after a while, not creating any output. – philippe Oct 26 '11 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.