[Geomoose-users] PDF legend print in GM3

Christopher Hughes chughes at co.lincoln.or.us
Tue Nov 17 08:33:39 PST 2020


What version of GeoMoose 3 are you using? (Have you pulled the current dev
version from github or are you using an official release?) Now that I think
of it,
the ability to add legends to print has been added since the last official
release.

If you're working on 3.6.2 (or earlier), that may be why it isn't working.

Chris

On Tue, Nov 17, 2020 at 12:21 AM flavio rigolon <flavio.rigolon at gmail.com>
wrote:

> Il giorno lun 16 nov 2020 alle ore 17:12 Christopher Hughes
> <chughes at co.lincoln.or.us> ha scritto:
> >
> > Hi Flavio,
>
> Hi Chris and thanks for the answer!
>
> >
> > Within that 'letter-landscape-legend' you referenced, there should be a
> legend element that specifies where the legend appears (as well
> > as a legend title and a box around the legend):
> >
> >         {
> >             type: 'text',
> >             x: 7.6, y: .9,
> >             text: 'Legend',
> >         },
> >         {
> >             type: 'legend',
> >             x: 7.61, y: 1.0
> >         },
> >         {
> >             type: 'rect',
> >             x: 7.6, y: .75,
> >             width: 2.4,
> >             height: 7,
> >             strokeWidth: .01,
> >          }
> >
> > You also need to make sure that you're telling it to use custom layouts
> in the print preview variable (if you haven't already). You can
> > try making minor adjustments other than the legend to make sure your
> custom layout is being used. I've also found it's easier to copy
> > the entire example and implement that before making my customizations.
> >
> >  var print_preview = app.add(gm3.components.PrintModal, 'print-preview',
> {
> >    layouts: custom_layouts
> >  });
> >
>
> Yes, I did it. I copied the entire example you mentioned (that I've
> found on the page) and pasted it in the app.js. So I added it to the
> var print_preview as you said. I can choose my new layout from the
> drop down menu I named "A4-verticale" (so it should be correctly
> loaded) but the generated PDF doesn't contain the legend: only the
> title, map, scale bar, title legend appear, and a rectangle for legend
> frame, but the legend is not there.
> I use millimeters (mm) as units so I thought the problem was there
> (perhaps my error on positioning the objects) but the same behaviour I
> encountered in my local demo site with demo data (after modifying the
> app.js for the new layout like above) in which I didn't modify any
> units.
>
> This is my settings in app.js:
>
>  {
>    label: 'A4-verticale',
>    orientation: 'portrait',
>    page: 'a4',
>    units: 'mm',
>    elements: [
>        {
>            type: 'text',
>            size: 18, fontStyle: 'bold',
>            x: 10, y: 15, text: '{{title}}'
>        },
>        {
>            type: 'map',
>            x: 10, y: 18.5,
>            width: 160, height: 160
>        },
>        {
>            type: 'rect',
>            x: 10, y: 18.5,
>            width: 160, height: 160,
>            strokeWidth: .1
>        },
>        {
>            type: 'text',
>            x: 10, y: 185, text: 'Stampato il {{day}}/{{month}}/{{year}}'
>        },
>        {
>            type: 'text',
>            x: 10, y: 190,
>            text: 'Legenda',
>        },
>        {
>            type: 'legend',
>            x: 10, y: 193
>        },
>        {
>            type: 'rect',
>            x: 10, y: 193,
>            width: 100, height: 100,
>            strokeWidth: .1
>        }
>
>    ]
>  }
>
> and then:
>
>   var print_preview = app.add(gm3.components.PrintModal, 'print-preview', {
>     layouts: custom_layouts
>   });
>
>
> Here is a link to the output:
> https://www.dropbox.com/s/nrc15pmplvf5lmv/geomoose_print_test.png?dl=0
>
> Thanks again for any hints
> flavio
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geomoose-users



-- 
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20201117/b0ec66f5/attachment.html>


More information about the Geomoose-users mailing list