0

I have use the Xamarin Control SignaturePad Form in my PCL project. The code as below:

public class DigitalSignature : ContentPage
 {
        SignaturePadView sign = new SignaturePadView();

        public DigitalSignature()
        {
            Button btnOk = new Button
            {
                Text = "Ok",
                BackgroundColor = Color.FromHex("#ff6600"),
                HorizontalOptions = LayoutOptions.End,
                WidthRequest = 100,
                HeightRequest = 35,
                FontSize = 15
            };

            btnOk.Clicked += btnOk_Clicked;

            sign = new SignaturePadView()
            {
                SignatureLineColor = Color.Red,
                StrokeColor = Color.Black,
                StrokeWidth = 10f,
                HeightRequest = 150,
                BackgroundColor = Color.White,
                ClearText = "Clear Me"
            };
            sign.CaptionText = "pls sign here";


            Content = new StackLayout
            {
                Children = {
                    sign,
                    btnOk
                }
            };

        }

        private void btnOk_Clicked(object sender, EventArgs e)
        {

        }
    }

How I can get the signature as image and store in the database(MSSQL)? In the signaturepadview do not has the getImage() function. Anyone has idea how I can do that?

Thanks

Bubble Bub
  • 651
  • 4
  • 12
  • 32
  • `var image = sign.GetImage();` is how you get the image, from https://components.xamarin.com/view/signature-pad which I'm guessing is what you are using, although correct me if I am wrong. As far as the database goes, what database? You haven't mentioned one in your question. – Danny Goodall Jan 24 '17 at 08:15
  • Hi Danny, there is no GetImage() function in the signaturepadView. – Bubble Bub Jan 24 '17 at 08:18
  • Is the link I provided in my first comment the control that you are using? – Danny Goodall Jan 24 '17 at 08:19
  • I download from nuget, Xamarin.Control.SignaturePad.form. The dll is SignaturePad.Forms and SignaturePad.Forms.Droid – Bubble Bub Jan 24 '17 at 08:26

1 Answers1

0

@Derick you have to use below code.

       Var mySignPad = new SignaturePadView()
        {
            StrokeWidth = 3,
            StrokeColor = Color.Black,
            BackgroundColor = Color.White,
            HeightRequest = 300,
            WidthRequest = 300
        };
   var getSignedImage = mySignPad.GetImageStreamAsync(SignatureImageFormat.Jpg);
DEV
  • 949
  • 1
  • 9
  • 29