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.
Up arrow icon