Guardar Firma del signaturePad en SQL server y recuperarla

Buen dia

Que proceso recomiendan para almecenar y recuperar la firma que se obtiene del SfSignaturePad en un Servidor de tipo SQL, he intentando convirtiendolo en un arreglo de bytes y este en un stream, pero no ha funcionado. 

6 Replies 1 reply marked as answer

SS Suganya Sethuraman Syncfusion Team February 8, 2021 05:31 AM UTC

Hi Juan,

Greetings from Syncfusion.

We have analyzed your query and you can fulfill your requirement by converting ImageSource To Bytes and you can store the bytes to server as like below code snippet.

XAML:

 
<StackLayout>  
        <Label Text="Input Your Signature"/>  
        <Frame>  
            <signature:SfSignaturePad   x:Name="signature"  
                                      HeightRequest="250"/>  
        </Frame>  
          
        <Button Text="ConvertSourceToBytes" Clicked="Button_Clicked"/>  
          
    </StackLayout>  


Convert ImageSource To Bytes:

C#:

 
          signature.Save();  
            StreamImageSource streamImageSource = (StreamImageSource)signature.ImageSource;  
            System.Threading.CancellationToken cancellationToken =  
            System.Threading.CancellationToken.None;  
            Task<Stream> task = streamImageSource.Stream(cancellationToken);  
            Stream stream = task.Result;  
  
            byte[] bytes = new byte[stream.Length];  
            stream.Read(bytes, 0, bytes.Length);  
  
            // Store bytes to server  

We  have created sample based on this, please find the sample from below.

Sample:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/SignaturePadSample864085032.zip

Please let us know if you have any other queries.

Regards,
Suganya Sethuraman.
 


Marked as answer

JU Juan February 8, 2021 04:45 PM UTC

Hola , 

Muchas gracias por la rápida respuesta , tengo otras dudas en SQL server lo guardo como un campo varbinary  y  convirtiendo el string de base 64 y luego para recuperarla hago la invertida  del proceso y podría ver la firma tanto en una webapp como en la app xamarin  ?


AS Anandraj Selvam Syncfusion Team February 9, 2021 01:26 PM UTC

Hi Juan, 
  
Thanks for the update. 
  
We are currently validating on this and we will update the details on February 11, 2021. We appreciate your patience until then. 
  
Regards, 
Anand Raj Selvam. 



RS Ruba Shanmugam Syncfusion Team February 11, 2021 11:43 AM UTC

Hi Juan,

Thank you for the update.

We have validated your query and we would like to let you know that, we were not clear about your exact requirement for "Could I see the signature both in a webapp and in the xamarin app". If it is possible to provide a sample of this or let us provide more details, it would be helpful to provide a better solution as soon as possible.

Regards,
Ruba Shanmugam



JU Juan February 11, 2021 02:44 PM UTC

Buen día

La idea es poder recoger la firma desde una app xamarin , almacenarla en una base de datos SQL y poder recuperar la para mostrarla en una pagina web que muestra  como una factura electrónica firmada.


RS Ruba Shanmugam Syncfusion Team February 12, 2021 07:30 AM UTC

Hi Juan,

Thanks for the update.

We would like to let you know that, in our SignaturePad control, we can't load a signature. But you can get a drawn signature in the control as an image source that you can convert to a memory stream and save to a database and load to a web page by converting the memory stream to the required web page format.

Please let us know, if you have any other concerns.

Regards,
Ruba Shanmugam

Loader.
Up arrow icon