[Users] legend icons Geoext PDF print
geographika
geographika at gmail.com
Thu Dec 16 10:28:54 CET 2010
Hi Rémi,
Use Fiddler or FireBug to capture the JSON that is being sent to your
server. This includes a legends property such as:
"legends":[{"name":"My
Layer","classes":[{"name":"","icons":["http://url.to.icon.....
Take the URL to the icon and see if you can access it correctly on the
print server. I had an of issue where the URL passed to the print
program pointed to the server's external URL which was not accessible
from the server itself.
Regards,
Seth G.
On 15/12/2010 12:05, Rémi Lagoin wrote:
> [Sorry, it's Better in English]
>
> No progress today ... any help is welcome:)
>
> 2010/12/15 Rémi Lagoin <remi.lagoin at gmail.com
> <mailto: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
> <mailto: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
> <mailto: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 <mailto: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.
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101216/d3476bfb/attachment.htm
More information about the Users
mailing list