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

Copy BASE64 image to clipboard and save it to disk

Please tell me :

  1. how can I copy a BASE64 image stored into a variable from variable to clipboard as image (not the text from variable's value) ? 
  2. how can I save a BASE64 image stored into a variable from variable to a file on disk ?


VAR_IMAGE_STRING="iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgA...."


I am using Blazor Webassembly, C# and .NET 6.

Thank You Very Much !


1 Reply

KG Keerthana Ganesan Syncfusion Team December 14, 2022 01:07 PM UTC

Hi Tom,

Greetings from Syncfusion support.

We have validated your reported query "
How to copy base64 image to clipboard" and we can achieve this requirement by configuring the Base64 SaveFormat type in the RichTextEditorImageSettings property.


Code snippets:

<SfButton OnClick="OnClick">Get Value</SfButton>

    <SfRichTextEditor @ref="rteObj">

        <ChildContent>

           

            <RichTextEditorToolbarSettings Items="@Tools"></RichTextEditorToolbarSettings>

            <RichTextEditorImageSettings SaveFormat="SaveFormat.Base64"></RichTextEditorImageSettings>

        </ChildContent>

</SfRichTextEditor>


public void OnClick()

        {

            Console.WriteLine(this.rteObj.Value);

            var value = this.rteObj.Value;// The value contains image value base64 string and you can save value to the database

        }


Kindly get back to us if you have further queries.


Regards,

Keerthana.


Loader.
Live Chat Icon For mobile
Up arrow icon