[Users] legend icons Geoext PDF print

Rémi Lagoin remi.lagoin at gmail.com
Wed Dec 15 12:05:46 CET 2010


[Sorry, it's Better in English]

No progress today ... any help is welcome:)

2010/12/15 Rémi Lagoin <remi.lagoin at gmail.com>

> Pas de progression aujourd'hui ... toute aide est bienvenue :)
>
> 2010/12/14 Rémi Lagoin <remi.lagoin at gmail.com>
>
> Thanks Andreas,
>>
>> I also tried this example, the legendPanel works well, printing the PDF is
>> done, but I only have the layer name in the caption, not the legend image
>> associated.
>>
>> Here is my code :
>>
>> --------------
>> var mapPanel, printPage;
>>
>> 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
>>         capabilities: printCapabilities // from the info.json script in
>> the html
>>     });
>>     // Our print page. Tells the PrintProvider about the scale and center
>> of
>>     // our page.
>>     printPage = new GeoExt.data.PrintPage({
>>         printProvider: printProvider,
>>         customParams: {
>>             mapTitle: "Printing Demo",
>>             comment: "This is a simple map printed from GeoExt.",
>>             copyright: "This is a simple map printed from GeoExt."
>>         }
>>     });
>>
>>     feux = new OpenLayers.Layer.WMS("feux", "http://xxxx/feux",
>>             {layers: "feux", format: 'image/jpeg', transparent: true},
>> {singleTile: true});
>>
>>    // The map we want to print
>>     mapPanel = new GeoExt.MapPanel({
>>         region: "center",
>>         layers: [feux],
>>         center: [146.56, -41.56],
>>         zoom: 6
>>     });
>>
>>     // The legend to optionally include on the printout
>>     var legendPanel = new GeoExt.LegendPanel({
>>         region: "west",
>>         width: 150,
>>         bodyStyle: "padding:5px",
>>         layerStore: mapPanel.layers,
>>         defaults: {
>>         style: 'padding:5px',
>>         baseParams: {
>>             FORMAT: 'image/png',
>>             LEGEND_OPTIONS: 'forceLabels:on'
>>         }
>>     }
>>
>>     });
>>
>>     mapPanel.map.addControl(new OpenLayers.Control.LayerSwitcher());
>>
>>     var includeLegend; // controlled by the "Include legend?" checkbox
>>
>>     // The main panel
>>     new Ext.Panel({
>>         renderTo: "content",
>>         layout: "border",
>>         width: 700,
>>         height: 420,
>>         items: [mapPanel, legendPanel],
>>         bbar: ["->", {
>>             text: "Print",
>>             handler: function() {
>>                 // convenient way to fit the print page to the visible map
>> area
>>                 printPage.fit(mapPanel, true);
>>                 // print the page, optionally including the legend
>>                 printProvider.print(mapPanel, printPage, includeLegend &&
>> {legend: legendPanel});
>>             }
>>         }, {
>>             xtype: "checkbox",
>>             boxLabel: "Include legend?",
>>             handler: function() {includeLegend = this.checked}
>>         }]
>>     });
>> });
>> -----------
>> And an extract of my Yaml config :
>>
>>        - !columns
>>            widths: [100]
>>            absoluteX: 300
>>            spacingAfter: 5
>>            items:
>>
>>             - !legends
>>                maxIconWidth: 0
>>                maxIconHeight: 0
>>                classIndentation: 0
>>                layerSpace: 5
>>                layerFontSize: 10
>>
>>
>> Is something wrong ?
>>
>> Thanks a lot,
>>
>> Rémi
>>
>>
>>
>> 2010/12/13 Andreas Hocevar <ahocevar at opengeo.org>
>>
>> Hi,
>>>
>>> have you tried to do something like in this example in your code:
>>> http://api.geoext.org/1.0/examples/print-page.html
>>>
>>> The essential part is to call the PrintProvider's print method with an
>>> additional option, e.g.
>>>
>>> printProvider.print(mapPanel, printPage, {legend: legendPanel});
>>>
>>> Also note that it is required to configure the server's config.yaml
>>> accordingly, as described here:
>>> http://api.geoext.org/1.0/docs/lib/GeoExt/data/PrintProvider.html
>>>
>>> - !legends
>>>    maxIconWidth: 0
>>>    maxIconHeight: 0
>>>    classIndentation: 0
>>>    layerSpace: 5
>>>    layerFontSize: 10
>>>
>>> Regards,
>>> Andreas.
>>>
>>> On Dec 13, 2010, at 18:10 , Rémi Lagoin wrote:
>>>
>>> > Hi all,
>>> >
>>> > I try to use the form print PDF GeoExt based servlet mapfish geoext as
>>> in the example (1).
>>> > The PDF generation is going well but I can not get the icons of the
>>> layers in the legend, I get only the name of the active layers.
>>> >
>>> > I use a TreePanel (with captions for each layer), a legendPanel
>>> (because I assume that its presence is essential to display the caption in
>>> the PDF?), And a MapPanel (required I guess).
>>> >
>>> > I also tried the Geoext.ux.SimplePrint, but no more success ... it
>>> gives me no icons layers ...
>>> >
>>> > The inclusion of the legend went very well with the widget mapfish
>>> (LayerTree) I feel that this is not so simple with a TreePanel and
>>> legendPanel ...
>>> >
>>> > Do you have any advice for me because I do not know what to do to move
>>> forward ...
>>> >
>>> > Thanks a lot!
>>> > Remi
>>> >
>>> > 1 - http://api.geoext.org/1.0/examples/print-form.html_______________________________________________
>>> > 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.
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101215/26e5d069/attachment-0001.htm 


More information about the Users mailing list