I am using the following code to get the signature image and show it to the user. var inputStream = signPadAfterWork.GetImage(ImageFormatType.Jpg); var buffer = new Byte[inputStream.Length]; var bytesRead = inputStream.Read(buffer, 0, (int)inputStream.Length); viewModel.SignatureTwoImageBytes = buffer; imgSignBeforeWork.Source = ImageSource.FromStream(() => new MemoryStream(viewModel.SignatureOneImageBytes));
It works on iOS but not on android.Any suggestions?
@Andrew.4149 said:
I thought it was transparency problem because images were showing up with black background in Crystal Reports. But then I saved image to SD card and realized they had a black background with jpegs which don't support transparency. Then I found the real problem. I didn't set the stroke and fill color. See below.
Has anyone successfully managed to convert the imagestream to a byte array on the Android platform in a PCL?
This works on iOS but I get an empty Byte Array on Android :
var sig = await padView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Jpg);
byte[] data = null;
BinaryReader br = new BinaryReader(sig);
data = br.ReadBytes((int)sig.Length);
Might help somebody but managed to get it working by using the following code and cast the steam to a MemoryStream:
var sig = await padView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Png);
var signatureMemoryStream = sig as MemoryStream;
byte[] data = signatureMemoryStream.ToArray();
@Andrew.4149 said:
I thought it was transparency problem because images were showing up with black background in Crystal Reports. But then I saved image to SD card and realized they had a black background with jpegs which don't support transparency. Then I found the real problem. I didn't set the stroke and fill color. See below.
signature.GetImage(Color.Black, Color.White)
Thanks that helps me too
This works for pure android coding, but when using it in xamarin forms, the image remains black, no matter what you do.
signature.GetImageStreamAsync(SignatureImageFormat.Png)
Posts
Sorry Allan, won't do that again
I think there is now scope to rebuild SignaturePad on top of SkiaSharp. Target all the platforms from one core implementation.
@nbevans said:
Hey,
Can you explain more what do you mean by that?
Thanks!
I am using the following code to get the signature image and show it to the user.
var inputStream = signPadAfterWork.GetImage(ImageFormatType.Jpg); var buffer = new Byte[inputStream.Length]; var bytesRead = inputStream.Read(buffer, 0, (int)inputStream.Length); viewModel.SignatureTwoImageBytes = buffer;
imgSignBeforeWork.Source = ImageSource.FromStream(() => new MemoryStream(viewModel.SignatureOneImageBytes));
It works on iOS but not on android.Any suggestions?
Im also having the same issue in reading the signature, Someone please.
Thanks that helps me too
Has anyone successfully managed to convert the imagestream to a byte array on the Android platform in a PCL?
This works on iOS but I get an empty Byte Array on Android :
Might help somebody but managed to get it working by using the following code and cast the steam to a MemoryStream:
Worked on both platforms
I am using Device.StartTimer to check for IsBlank property every 100ms to enable/disable Save button.
In view model constructor:
Device.StartTimer(new TimeSpan(0, 0, 0, 0, 100), () => { CheckSignature(); return true; });
void CheckSignature()
{
bool isBlank = Pad..IsBlank;
IsSaveEnabled = !isBlank;
}
Is there a way to raise a ClearSignature event for the SignaturePad?
I do not want to use the Clear text on the top-right of the signature pad. Instead I want to use my own button outside the pad.
Hi,
When using the signature pad, in Android, the image always has a black background. Is there any workaround for this?
This works for pure android coding, but when using it in xamarin forms, the image remains black, no matter what you do.
signature.GetImageStreamAsync(SignatureImageFormat.Png)
Jeremy.3554 you manage to find a XForms solution to the black image rendering?
i done a small sample on signaturePad by using dependency in xamarin.forms, here it is......
Hi EveryOne,
I did a sample on SignaturePad
Here I used CustomRederers and DependencyService concepts.
In this sample, We are able to get users signature in both iOS and android and we are also able to save it as an image into our local device storage.
Please find the sample
no compila en mi dice Operacion Implementar omitida proyecto SignatureSample.Droid