[Users] Error while Creating PDF via mapfish-printmodul

Andreas Hocevar ahocevar at opengeo.org
Thu Jun 16 16:13:23 CEST 2011


Hi,

looks like your PrintProvider is not connected to a map.

Andreas.

On Thu, Jun 16, 2011 at 3:30 PM, Kai Volland <kaivolland at web.de> wrote:
> Hi everybody,
>
> i try to create a print form where i can type in a title and a comment quite
> like this:
>  http://api.geoext.org/1.0/examples/print-form.html
>
> When i click the "Create PDF"-Button i get this error:
>
> map.getUnits is not a function --> PrintProvider.js (Zeile 383)
>
> I really don't know how  i could fix it.
>
> Maybe anyone can help me.
>
> Kind regards
>
> Kai
>
> And here comes the code:
>
>     // print
>     // SIMPLEPRINT
>
>     var printProvider = new GeoExt.data.PrintProvider({
>         method: "GET", // "POST" recommended for production use
>         capabilities: printCapabilities, // provide url instead for lazy
> loading
>         customParams: {
>             imageurl: "FAKE.png",
>         }
>     });
>
>     var printPage = new GeoExt.data.PrintPage({
>         printProvider: printProvider
>     });
>
>
>     var form = new Ext.FormPanel({
>         region: "east",
>         labelWidth: '30%',
>         frame:true,
>         title: 'Metadata',
>         width: '100%',
>         items:[{
>             width: '70%',
>             xtype: "textfield",
>             fieldLabel: 'Title',
>             name: 'mapTitle',
>             plugins: new GeoExt.plugins.PrintPageField({
>                 printPage: printPage
>             })
>             },{
>             width: '70%',
>             xtype: "textarea",
>             fieldLabel: 'Comment',
>             name: 'comment',
>             plugins: new GeoExt.plugins.PrintPageField({
>                 printPage: printPage
>             })
>         }],
>         buttons:[{
>             text: 'Create PDF',
>             handler: function() {
>                 printProvider.print(printPage);
>             }
>         }]
>     });
>
>
>
>     var action2 = new GeoExt.Action({
>         map: map,
>         cls: 'x-btn-text-icon',
>         tooltip: 'Create PDF',
>         icon: imagePath + '/pdf.png',
>         handler: function(){
>             // A window with the PrintMapPanel, which we can use to adjust
>             // the print extent before creating the pdf.
>             printDialog = new Ext.Window({
>                 title: "Print Preview",
>                 layout: "fit",
>                 width: 350,
>                 autoHeight: true,
>                 items: [{
>                     xtype: "gx_printmappanel",
>                     sourceMap: mappanel,
>                     printProvider: printProvider
>                     },
>                     form
>                 ]
>             });
>             printDialog.show();
>         }
>     });
>     actions["print"] = action2;
>     toolbarItems.push(action2);
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list