Search results

Print And Export in Blazor Linear Gauge component

Print

To use the print functionality, we should set the AllowPrint property to true. The rendered linear gauge can be printed directly from the browser by calling the method print. You can get the Linear Gauge component object using @ref="Gauge"

@using Syncfusion.Blazor.LinearGauge

<button @onclick="PrintGauge">Print</button>
<SfLinearGauge @ref="Gauge" AllowPrint="true">
</SfLinearGauge>

@code {
    SfLinearGauge Gauge;
    void PrintGauge()
    {
        this.Gauge.Print();
    }
}

Linear Gauge Print Sample

Export

Image Export

To use the image export functionality, we should set the AllowImageExport property to true. The rendered linear gauge can be exported as an image using the export method. The method requires two parameters: image type and file name. The linear gauge can be exported as an image in the following formats.

  • JPEG
  • PNG
  • SVG
@using Syncfusion.Blazor.LinearGauge
<button @onclick="ExportGauge">Export</button>
<SfLinearGauge @ref="Gauge" AllowImageExport="true">
</SfLinearGauge>

@code {
    SfLinearGauge Gauge;
    void ExportGauge()
    {
        this.Gauge.Export(ExportType.PNG, "LinearGauge");
    }
}

Linear Gauge Export Sample

PDF Export

To use the PDF export functionality, we should set the AllowPdfExport property to true. The rendered linear gauge can be exported as PDF using the export method. The export method requires three parameters: file type, file name and orientation of the PDF document. The orientation setting is optional and “0” indicates portrait and “1” indicates landscape.

@using Syncfusion.Blazor.LinearGauge
<button @onclick="ExportGauge">Export</button>
<SfLinearGauge @ref="Gauge" AllowPdfExport="true">
</SfLinearGauge>

@code {
    SfLinearGauge Gauge;
    void ExportGauge()
    {
        this.Gauge.Export(ExportType.PDF, "LinearGauge", 0);
    }
}

Linear Gauge Export Sample