Search results

Print and export in Blazor Maps component

Print

The rendered maps can be printed directly from browser by calling the public method Print. You can get the Maps component object using @ref="maps".

@using Syncfusion.Blazor.Maps

<button @onclick="PrintMap">Print</button>
@*  To create reference  *@
<SfMaps @ref="maps">
    <MapsLayers>
        <MapsLayer ShapeData='new {dataOptions= "https://cdn.syncfusion.com/maps/map-data/world-map.json"}'>
            <MapsLayerTooltipSettings Visible="true"
                                  ValuePath="name">
            </MapsLayerTooltipSettings>
        </MapsLayer>
    </MapsLayers>
</SfMaps>

@code {
    SfMaps maps;
    void PrintMap()
    {
        // using Maps component reference call 'Print' method
        maps.Print();
    }
}

Maps with print option

Export

The rendered maps can be exported in the following formats using the Export method. The input parameters for this method are export type for format and file name of result.

  • PNG
  • JPEG
  • SVG
  • PDF
@using Syncfusion.Blazor.Maps

<button @onclick="ExportMap">Export</button>
<SfMaps @ref="Maps">
    <MapsLayers>
        <MapsLayer ShapeData='new {dataOptions= "https://cdn.syncfusion.com/maps/map-data/world-map.json"}'>
        </MapsLayer>
    </MapsLayers>
</SfMaps>

@code {
    SfMaps Maps;
    void ExportMap()
    {
        maps.Export(ExportType.PNG, "World Map");
    }
}

Maps with export option

Export the tile maps

The rendered map with providers such as OSM, Bing and Google static maps can be exported using the Export method. It supports the following export formats.

  • JPEG
  • PNG
  • PDF
@using Syncfusion.Blazor.Maps

<button @onclick="ExportMap">Export</button>
<SfMaps @ref="Maps">
    <MapsLayers>
        <MapsLayer LayerType="ShapeLayerType.OSM">
        </MapsLayer>
    </MapsLayers>
</SfMaps>

@code {
    SfMaps Maps;
    void ExportMap()
    {
        maps.Export(ExportType.PNG, "OSM Map");
    }
}

Maps with export option