We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Return type of export

I'm trying to follow this example https://blazor.syncfusion.com/documentation/chart/chart-print#export

that says that the return type is a base64 string, nevertheless when I try to assign the return value from the function to a variable ive got an error.

Screenshot (63).png

1 Reply

SB Swetha Babu Syncfusion Team November 18, 2022 07:27 AM

Hi Jose,

Greetings from Syncfusion.

We can get the base64 string using the DataUrl argument in OnExportComplete event of the chart. When calling the ExportAsync method, the OnExportComplete event gets triggered. We have created a simple blazor application to demonstrate the same and it can be downloaded from the below link.

Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ChartExport-1707732033

Code Snippet:

<SfButton @onclick="ExportChart" Content="Export" CssClass="e-flat" IsPrimary="true"></SfButton>

<SfChart @ref="@chartInstance">   

    <ChartEvents OnExportComplete="@GetUrl"></ChartEvents>



public async Task ExportChart(MouseEventArgs args)


        await chartInstance.ExportAsync(ExportType.PNG, "Chart", Syncfusion.PdfExport.PdfPageOrientation.Portrait, false);


    public void GetUrl(ExportEventArgs Args)


        var dataURL = Args.DataUrl;

        string encodedString = dataURL.Split("base64,")[1];

        byte[] data = Convert.FromBase64String(encodedString);


Kindly, revert us if you have any concerns.



Live Chat Icon For mobile
Up arrow icon