Category / Section
How to download the rendered India map
2 mins read
How to download the rendered India map?
Export the map
The rendered EJ2 maps control can be downloaded locally and used further. This can be done by calling the export method in maps. You can export the map in the below formats.
- PNG
- JPEG
- SVG
The input parameters for this method are export type and file name.
import { Maps, DataLabel } from '@syncfusion/ej2-maps'; import { IndiaMap } from './india'; Maps.Inject(DataLabel); let maps: Maps = new Maps({ layers: [ { shapeData: IndiaMap, //.. } ] }); maps.appendTo('#container'); document.getElementById('export').onclick = () => { maps.export('PNG', 'Maps'); };
In the above code, on clicking a button, maps is exported in PNG format. The below screenshot shows the output of the code snippet.
Sample link - Export map
Print the map
In addition to exporting, you can also print the renderer maps directly from the browser by calling the print method.
import { Maps, DataLabel } from '@syncfusion/ej2-maps'; import { IndiaMap } from './india'; Maps.Inject(DataLabel); let maps: Maps = new Maps({ layers: [ { shapeData: IndiaMap, //.. } ] }); maps.appendTo('#container'); document.getElementById('print').onclick = () => { maps.print(); };
Sample link – Print map
Learn more details about printing and exporting of the maps from this UG link.