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 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!

share|improve this question
    
Did you get anywhere with this? We are having a similar problem. –  user7231 Apr 30 '12 at 11:39
add comment

1 Answer

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.

share|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%2F‌​DOP_JPG%3F%22%2C%22opacity%22%3A1%2C%22singleTile%22%3Afalse%2C%22type%22%3A%22WM‌​S 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
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.