Description
The export plugin currently only lets users click a single format, which then downloads/opens in a new tab or is stored in the plugin store. The output is a simple screenshot at screen resolution in a fixed A4 landscape layout which is not suitable for proper printouts.
This feature adds an opt-in, fully-featured, purely client-side print mode on top of it without any dependency on a MapFish print server.
A new configuration parameter advanced: boolean (default false) controls the behavior:
advanced: false: behaves exactly as today. Click a format, result is downloaded/opened or stored.
advanced: true: shows a print interface where users can configure the export before generating it.
In advanced mode, users should be able to choose the following options:
- Format (e.g. DIN A5–A0, portrait/landscape)
- DPI/resolution of the map image; low (96 dpi), medium (150 dpi) or high (300 dpi)
- optional: title (free text input); not set if empty
- optional: tooter (free text input); not set if empty
- optional: legend of the active layers
- optional: source attribution (attributions); only possible if
attributions is configured
The result is generated, saved in the store and downloaded in the selected format with the map and selected components being arranged in a print-ready layout.
Affected areas
| File |
What needs to change |
src/plugins/export/types.ts |
Currently only knows download and formats; add advanced flag plus new options described above. |
src/plugins/export/store.ts |
Extend exportAs with state for above options; add print rendering for advanced mode; keep the existing screenshot path for advanced: false |
src/plugins/export/utils/convertToPdf.ts |
Remove hard-wired A4 landscape (const format = 'a4'); support format (default 'a4'/orientation/DPI; place title, footer, legend, source attribution into the PDF layout |
src/plugins/export/utils/getCanvasFromMap.ts |
Enable rendering at target resolution (DPI) instead of the current viewport/screen resolution |
src/plugins/export/components/ExportUI.ce.vue |
Render the options form when advanced: true, keep the plain format buttons when advanced: false; add separate components for both modes |
src/plugins/export/locales.ts |
New labels/tooltips for all new options |
src/plugins/layerChooser/utils/findInCapabilities.ts |
Abstract the function to obtain legend URLs of the active layers for printing |
Out of scope
- No connection to a MapFish print server or other server-side print backends.
- No changes to the default (
advanced: false) behavior beyond keeping it intact.
- No freely definable, fully customizable print templates (only the components listed above).
- No export of feature/attribute tables beyond the legend.
Description
The
exportplugin currently only lets users click a single format, which then downloads/opens in a new tab or is stored in the plugin store. The output is a simple screenshot at screen resolution in a fixed A4 landscape layout which is not suitable for proper printouts.This feature adds an opt-in, fully-featured, purely client-side print mode on top of it without any dependency on a MapFish print server.
A new configuration parameter
advanced: boolean(defaultfalse) controls the behavior:advanced: false: behaves exactly as today. Click a format, result is downloaded/opened or stored.advanced: true: shows a print interface where users can configure the export before generating it.In advanced mode, users should be able to choose the following options:
attributionsis configuredThe result is generated, saved in the store and downloaded in the selected format with the map and selected components being arranged in a print-ready layout.
Affected areas
src/plugins/export/types.tsdownloadandformats; addadvancedflag plus new options described above.src/plugins/export/store.tsexportAswith state for above options; add print rendering for advanced mode; keep the existing screenshot path foradvanced: falsesrc/plugins/export/utils/convertToPdf.tsconst format = 'a4'); support format (default'a4'/orientation/DPI; place title, footer, legend, source attribution into the PDF layoutsrc/plugins/export/utils/getCanvasFromMap.tssrc/plugins/export/components/ExportUI.ce.vueadvanced: true, keep the plain format buttons whenadvanced: false; add separate components for both modessrc/plugins/export/locales.tssrc/plugins/layerChooser/utils/findInCapabilities.tsOut of scope
advanced: false) behavior beyond keeping it intact.