[Geoserver-users] PrintMap with Geoext + GeoServer

am trying to print a map with GeoEXT and geoserver i successed to show the print panel but when i click the print button i get this error:

 Error while generating PDF:
 org.mapfish.print.InvalidJsonValueException: spec.pages[0].dpi has an invalid value: 0
at org.mapfish.print.config.layout.MapBlock.createTransformer(MapBlock.java:79)
at org.mapfish.print.config.layout.MapBlock.render(MapBlock.java:51)
at org.mapfish.print.config.layout.Page.render(Page.java:65)
at org.mapfish.print.config.layout.MainPage.render(MainPage.java:62)
at org.mapfish.print.config.layout.Layout.render(Layout.java:59)
at org.mapfish.print.MapPrinter.print(MapPrinter.java:144)
at      org.mapfish.print.servlet.MapPrinterServlet.doCreatePDFFile(MapPrinterServlet.java:275)
at org.mapfish.print.servlet.MapPrinterServlet.createAndGetPDF(MapPrinterServlet.java:130)
at org.mapfish.print.servlet.MapPrinterServlet.doGet(MapPrinterServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:159)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)

i can’t figure out where the problem occurs and when i try to reach the MapBlock.java line 79, i have no atteched source (not found) and my html page is :

 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
      <html>
      <head>
     <title>
      A map
     </title>
    <script src="../ext-3.4.1/adapter/ext/ext-base.js"" type="text/javascript"></script>
   <script src="../ext-3.4.1/ext-all.js" type="text/javascript"></script>
   <link rel="stylesheet" type="text/css" href="../ext-3.4.1/resources/css/ext-all.css">
   <script src="../openlayers/OpenLayers.js" type="text/javascript"></script>
   <script src="../openlayers/lib/deprecated.js" type="text/javascript"></script>
   <script src="../GeoExt/lib/GeoExt.js" type="text/javascript"></script>
   <link rel="stylesheet" type="text/css" href="../GeoExt/resources/css/geoext-all-debug.css">
    <script src="[http://maps.google.com/maps/api/js?v=3&amp;sensor=false](http://maps.google.com/maps/api/js?v=3&sensor=false)"></script>

 <script type="text/javascript">

  var mapPanel, printDialog;

        Ext.onReady(function() {
  // The PrintProvider that connects us to the print service
  var printProvider = new GeoExt.data.PrintProvider({   
  method: "GET", // "POST" recommended for production use
  url: "[http://localhost:8080/geoserver/pdf/info.json?var=printCapabilities](http://localhost:8080/geoserver/pdf/info.json?var=printCapabilities)", 
   customParams: {
    mapTitle: "GeoExt Printing Demo",
    comment: "This demo shows how to use GeoExt.PrintMapPanel"
  }
 });

   // A MapPanel with a "Print..." button
  mapPanel = new GeoExt.MapPanel({
renderTo: "content",
width: 500,
height: 350,
map: {
    maxExtent: new OpenLayers.Bounds(
        143.835, -43.648,
        148.479, -39.574
    ),
    maxResolution: 0.018140625,
    projection: "EPSG:4326",
    units: 'degrees'
},
layers: [new OpenLayers.Layer.WMS("Tasmania State Boundaries",
    "[http://demo.opengeo.org/geoserver/wms](http://demo.opengeo.org/geoserver/wms)",
    {layers: "topp:tasmania_state_boundaries"},
    {singleTile: true, numZoomLevels: 8})],
center: [146.56, -41.56],
zoom: 0,
bbar: [{
    text: "Print...",
    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
            }],
            bbar: [{
                text: "Create PDF",
                handler: function(){ printDialog.items.get(0).print(); }
            }]
        });
        printDialog.show();
    }
     }]
   });

   });

  </script>
  </head>
 <body>
  <div id='content'></div>
  </body>
 </html>

Asma OUQALLI

Élève ingénieur : 3ème Sciences d’Information Géographique (SIG).
Chef de commission développement professionnel - Rotaract EHTP.
Chef de cellule Media - Olympiades EHTP 2012.
Ecole Hassania des Travaux Publics.
Mobile : +212 672 48 23 15.
Email : asma.ouqalli@anonymised.com

Asma OUQALLI

Élève ingénieur : 3ème Sciences d’Information Géographique (SIG).
Chef de commission développement professionnel - Rotaract EHTP.
Chef de cellule Media - Olympiades EHTP 2012.
Ecole Hassania des Travaux Publics.
Mobile : +212 672 48 23 15.
Email : asma.ouqalli@anonymised.com