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

Export Chart as jpeg to a binary field


We use in our program the possibility to export different charts. These are nicely downloaded in the browser.
Is it also possible to export charts as binary data? This way we could store the image in a separate database.

Thanks and regards,


3 Replies

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

Hi Bob,

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.



BF Bob Fiering November 18, 2022 08:22 AM

Hi Swetha,

Thank you very much for the fast response and solution.
This is exactly what I was hoping for.
I will build this solution in our program.



DG Durga Gopalakrishnan Syncfusion Team November 22, 2022 12:53 AM

Hi Bob,

Most welcome. Please get back to us if you need any further assistance. We are always happy in assisting you.


Durga Gopalakrishnan.

Live Chat Icon For mobile
Up arrow icon